Represent a polymorphic wrapper capable of holding any type.
Public Constructors | |
| any_object () noexcept=default | |
| Initializes a new instance of the xtd::any_object class. | |
| template<typename type_t > | |
| any_object (type_t &&value) noexcept | |
| Initializes a new instance of the xtd::any_object class with specified value. | |
| template<typename type_t > | |
| any_object (type_t &value) noexcept | |
| Initializes a new instance of the xtd::any_object class with specified value. | |
| template<typename type_t > | |
| any_object (const type_t &value) noexcept | |
Public Properties | |
| bool | has_value () const noexcept |
| Gets a value indicating whether the current xtd::any_object object has a valid value of its underlying type. | |
| const object & | value () const |
| Gets the value of the current xtd::any_object object if it has been assigned a valid underlying value. | |
Public Methods | |
| int32 | compare_to (const any_object &other) const noexcept override |
| Compares the current instance with another object of the same type. | |
| bool | equals (const object &other) const noexcept override |
| Determines whether the specified object is equal to the current object. | |
| bool | equals (const any_object &other) const noexcept override |
| Indicates whether the current object is equal to another object of the same type. | |
| xtd::size | get_hash_code () const noexcept override |
| Serves as a hash function for a particular type. | |
| string | to_string () const noexcept override |
| Returns a xtd::string that represents the current object. | |
| void | reset () noexcept |
| Reset the current object. Set the current object to null. | |
Public Operators | |
| any_object & | operator= (const any_object &other)=default |
| Copy assignment operator. Replaces the contents with a copy of the contents of other. | |
| any_object & | operator= (any_object &&other) |
| Move assignment operator. Replaces the contents with a copy of the contents of other. | |
Additional Inherited Members | |
Public Member Functions inherited from xtd::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<typename object_t > | |
| xtd::uptr< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
Static Public Member Functions inherited from xtd::object | |
| template<typename object_a_t , typename 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<typename object_a_t , typename 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. | |
|
defaultnoexcept |
Initializes a new instance of the xtd::any_object class.
|
inlinenoexcept |
Initializes a new instance of the xtd::any_object class with specified value.
| value | The value to initialize the contained value with. |
|
inlinenoexcept |
Initializes a new instance of the xtd::any_object class with specified value.
| value | The value to initialize the contained value with. |
|
inlinenoexcept |
Gets a value indicating whether the current xtd::any_object object has a valid value of its underlying type.
|
inline |
Gets the value of the current xtd::any_object object if it has been assigned a valid underlying value.
| xtd::invalid_operation_exception | The xtd::any_object::has_value property is false. |
|
inlineoverridevirtualnoexcept |
Compares the current instance with another object of the same type.
| obj | An object to compare with this instance. |
| 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< any_object >.
|
inlineoverridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
| obj | The object to compare with the current object. |
Reimplemented from xtd::object.
|
inlineoverridevirtualnoexcept |
Indicates whether the current object is equal to another object of the same type.
| obj | An object to compare with this object. |
true if the current object is equal to the other parameter; otherwise, false. Implements xtd::iequatable< any_object >.
|
inlineoverridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
|
inlineoverridevirtualnoexcept |
Returns a xtd::string that represents the current object.
Reimplemented from xtd::object.
|
inlinenoexcept |
Reset the current object. Set the current object to null.
|
default |
Copy assignment operator. Replaces the contents with a copy of the contents of other.
| other | Another polymorphic wrapper. |
|
inline |
Move assignment operator. Replaces the contents with a copy of the contents of other.
| other | Another polymorphic wrapper. |