template<class type_t>
class xtd::shared_ptr_object< type_t >
The xtd::shared_ptr_object is a shared pointer as std::shared_ptr.
- Library
- xtd.core
- Examples
- This example shows to use xtd::shared_ptr_object with xtd::version class
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The xtd::shared_ptr_object is a shared pointer as std::shared_ptr.
Definition shared_ptr_object.hpp:30
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.hpp:114
xtd::string to_string() const noexcept override
Converts the value of the current xtd::version object to its equivalent xtd::string representation.
void delete_shared_ptr_object(shared_ptr_object< type_t > &ptr)
xtd::delete_shared_ptr_object operator delete a xtd::shared_ptr_object or xtd::ptr object.
Definition delete_shared_ptr_object.hpp:25
- Examples
- as.cpp, assert_is_not_null.cpp, assert_is_null.cpp, assume_is_not_null.cpp, assume_is_null.cpp, console_firework.cpp, format_pointer.cpp, graph_control.cpp, object_memberwise_clone.cpp, object_to_string.cpp, socket_tcp_ip_v4_without_thread.cpp, timers_timer_synchronizing_object.cpp, valid_is_not_null.cpp, and valid_is_null.cpp.
|
bool | is_unique () const noexcept |
| Checks whether the managed object is managed only by the current xtd::shared_ptr_object object.
|
|
template<class value_t > |
bool | owner_before (const shared_ptr_object< value_t > &other) const noexcept |
| Provides owner-based ordering of shared pointers.
|
|
template<class value_t > |
bool | owner_before (const std::shared_ptr< value_t > &other) const noexcept |
| Provides owner-based ordering of shared pointers.
|
|
template<class value_t > |
bool | owner_before (const std::weak_ptr< value_t > &other) const noexcept |
| Provides owner-based ordering of shared pointers.
|
|
base_type | pointer () const noexcept |
| Returns the underlying base type pointer.
|
|
xtd::size | use_count () const noexcept |
| Gets the number of xtd::shared_ptr_object objects referring to the same managed object.
|
|
|
int32 | compare_to (const shared_ptr_object &obj) const noexcept override |
| Compares the current instance with another object of the same type.
|
|
bool | equals (const xtd::object &value) const noexcept override |
| Determines whether the specified object is equal to the current object.
|
|
bool | equals (const shared_ptr_object &value) const noexcept override |
| Indicates whether the current object is equal to another object of the same type.
|
|
element_type * | get () const noexcept |
| Gets the stored pointer.
|
|
xtd::size | get_hash_code () const noexcept override |
| Serves as a hash function for a particular type.
|
|
void | reset () noexcept |
| Reset the current object. Set the current object to null.
|
|
template<class pointer_t > |
void | reset (pointer_t *ptr) noexcept |
| Reset the current object. Set the current object with specified pointer.
|
|
void | swap (shared_ptr_object &ptr) noexcept |
| Swaps this current instance with specified shared pointer object.
|
|
type_t & | to_object () const noexcept |
| Gets the stored object.
|
|
template<typename target_t > |
target_t | to_object () const |
| Gets the stored object with specified target_t type.
|
|
type_t * | to_pointer () const noexcept |
| Gets the stored pointer.
|
|
template<typename target_t > |
target_t * | to_pointer () const |
| Gets the stored pointer with specified target_t type.
|
|
xtd::string | to_string () const noexcept override |
| Returns a xtd::string that represents the current object.
|
|
|
| object ()=default |
| Create a new instance of the ultimate base class object.
|
|
virtual type_object | get_type () const noexcept |
| Gets the type of the current instance.
|
|
template<class object_t > |
xtd::uptr< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object.
|
|
template<class object_a_t , class object_b_t > |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal.
|
|
template<class object_a_t , class object_b_t > |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance.
|
|
◆ base_type
◆ element_type
Represent the element type.
◆ weak_type
◆ shared_ptr_object() [1/9]
◆ shared_ptr_object() [2/9]
◆ shared_ptr_object() [3/9]
Initializes a new instance of the xtd::shared_ptr_object class with specified shared pointer object.
- Parameters
-
value | The shared pointer object. |
◆ shared_ptr_object() [4/9]
Initializes a new instance of the xtd::shared_ptr_object class with specified shared pointer object.
- Parameters
-
value | The shared pointer object. |
◆ shared_ptr_object() [5/9]
template<class type_t >
template<class pointer_t >
◆ shared_ptr_object() [6/9]
template<class type_t >
template<class value_t >
Initializes a new instance of the xtd::shared_ptr_object class with specified shared pointer object.
- Parameters
-
value | The shared pointer object. |
◆ shared_ptr_object() [7/9]
template<class type_t >
template<class value_t >
Initializes a new instance of the xtd::shared_ptr_object class with specified shared pointer object.
- Parameters
-
value | The shared pointer object. |
◆ shared_ptr_object() [8/9]
template<class type_t >
template<class value_t >
Initializes a new instance of the xtd::shared_ptr_object class with specified shared pointer object.
- Parameters
-
value | The shared pointer object. |
◆ shared_ptr_object() [9/9]
template<class type_t >
template<class value_t >
Initializes a new instance of the xtd::shared_ptr_object class with specified shared pointer object.
- Parameters
-
value | The shared pointer object. |
◆ is_unique()
◆ owner_before() [1/3]
template<class type_t >
template<class value_t >
Provides owner-based ordering of shared pointers.
- Parameters
-
- Returns
true
if thid current instance precedes other
; otherwise false
.
◆ owner_before() [2/3]
template<class type_t >
template<class value_t >
Provides owner-based ordering of shared pointers.
- Parameters
-
- Returns
true
if thid current instance precedes other
; otherwise false
.
◆ owner_before() [3/3]
template<class type_t >
template<class value_t >
Provides owner-based ordering of shared pointers.
- Parameters
-
other | The std::weak_ptr to be compared. |
- Returns
true
if thid current instance precedes other
; otherwise false
.
◆ pointer()
Returns the underlying base type pointer.
- Returns
- The underlying base type pointer.
◆ use_count()
◆ compare_to()
template<class type_t >
|
inlineoverridevirtualnoexcept |
Compares the current instance with another object of the same type.
- Parameters
-
obj | An object to compare with this instance. |
- Returns
- A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
Value | Condition |
Less than zero | This instance is less than obj. |
Zero | This instance is equal to obj. |
Greater than zero | This instance is greater than obj. |
Implements xtd::icomparable< shared_ptr_object< type_t > >.
◆ equals() [1/2]
template<class type_t >
|
inlineoverridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
- Parameters
-
obj | The object to compare with the current object. |
- Returns
true
if the specified object is equal to the current object. otherwise, false
.
Reimplemented from xtd::object.
◆ equals() [2/2]
template<class type_t >
|
inlineoverridevirtualnoexcept |
Indicates whether the current object is equal to another object of the same type.
- Parameters
-
obj | An object to compare with this object. |
- Returns
true
if the current object is equal to the other parameter; otherwise, false
.
Implements xtd::iequatable< shared_ptr_object< type_t > >.
◆ get()
Gets the stored pointer.
- Returns
- The stored pointer.
◆ get_hash_code()
template<class type_t >
|
inlineoverridevirtualnoexcept |
Serves as a hash function for a particular type.
- Returns
- size_t A hash code for the current object.
Reimplemented from xtd::object.
◆ reset() [1/2]
Reset the current object. Set the current object to null.
◆ reset() [2/2]
template<class type_t >
template<class pointer_t >
Reset the current object. Set the current object with specified pointer.
- Parameters
-
ptr | The pointer to assign the current object. It can be null. |
◆ swap()
Swaps this current instance with specified shared pointer object.
- Parameters
-
ptr | The shared pointer object to swap with this current instance. |
◆ to_object() [1/2]
Gets the stored object.
- Returns
- The stored object.
◆ to_object() [2/2]
template<class type_t >
template<typename target_t >
Gets the stored object with specified target_t
type.
- Returns
- The stored object.
- Exceptions
-
xtd::cast_exception | If the current object can't be casted in target_t. |
◆ to_pointer() [1/2]
Gets the stored pointer.
- Returns
- The stored pointer.
◆ to_pointer() [2/2]
template<class type_t >
template<typename target_t >
Gets the stored pointer with specified target_t
type.
- Returns
- The stored pointer.
- Exceptions
-
xtd::cast_exception | If the current object can't be casted in target_t. |
◆ to_string()
◆ operator=() [1/6]
◆ operator=() [2/6]
◆ operator=() [3/6]
template<class type_t >
template<class value_t >
◆ operator=() [4/6]
template<class type_t >
template<class value_t >
◆ operator=() [5/6]
template<class type_t >
template<class value_t >
Assignment operator with specified std::shared_ptr value.
- Parameters
-
value | The value to assign. |
◆ operator=() [6/6]
template<class type_t >
template<class value_t >
Assignment operator with specified std::shared_ptr value.
- Parameters
-
value | The value to assign. |
◆ operator*()
Gets the stored object.
- Returns
- The stored object.
◆ operator->()
Gets the stored pointer.
- Returns
- The stored pointer.
◆ operator[]()
Provides indexed access to the stored array.
- Parameters
-
- Returns
- A reference to the index-th element of the array, i.e.,
get()[index]
.
◆ operator bool()
Checks if the stored pointer is not null.
- Returns
true
if stored pointer is non null; otherwise false
.
◆ operator base_type()
Returns the underlying base type pointer.
- Returns
- The underlying base type pointer.
◆ empty
The documentation for this class was generated from the following file: