xtd 1.0.0
Loading...
Searching...
No Matches
xtd::reference_wrapper_object< type_t > Class Template Reference
Inheritance diagram for xtd::reference_wrapper_object< type_t >:
xtd::object xtd::icomparable< reference_wrapper_object< type_t > > xtd::iequatable< reference_wrapper_object< type_t > > xtd::interface xtd::extensions::comparison_operators< type_t, icomparable< type_t > > xtd::interface xtd::extensions::equality_operators< type_t, iequatable< type_t > >

Definition

template<typename type_t>
class xtd::reference_wrapper_object< type_t >

The xtd::reference_wrapper_object is a reference wrapper as std::reference_wrapper.

Library
xtd.core
Examples
This example shows to use xtd::reference_wrapper_object with xtd::version class
version ver = version {1, 2, 3};
console::write_line("version = {}", ver_ref.to_string());
static auto write_line() -> void
Writes the current line terminator to the standard output stream using the specified format informati...
The xtd::reference_wrapper_object is a reference wrapper as std::reference_wrapper.
Definition reference_wrapper_object.hpp:38
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.hpp:115
auto create_reference_wrapper_object(type_t &arg) noexcept -> reference_wrapper_object< type_t >
xtd::create_reference_wrapper_object operator. This operator creates a xtd::reference_wrapper_object ...
Definition create_reference_wrapper_object.hpp:24

Public Aliases

using base_type
 Represents the base type (std::reference_wrapper<type_t>).
using type
 Represent the referenced type.
using reference_type
 Represent the referenced type.

Public Static Fields

static const reference_wrapper_object empty
 Represents the empty xtd::reference_wrapper_object. This field is constant.

Public Operators

auto operator= (const reference_wrapper_object &value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object value.
auto operator= (reference_wrapper_object &value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object value.
auto operator= (reference_wrapper_object &&value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object value.
template<typename value_t>
auto operator= (const reference_wrapper_object< value_t > &value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object value.
template<typename value_t>
auto operator= (reference_wrapper_object< value_t > &value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object value.
template<typename value_t>
auto operator= (reference_wrapper_object< value_t > &&value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object value.
template<typename value_t>
auto operator= (const std::reference_wrapper< value_t > &value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object::base_type value.
template<typename value_t>
auto operator= (std::reference_wrapper< value_t > &value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object::base_type value.
auto operator= (const base_type &value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object::base_type value.
auto operator= (base_type &value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object::base_type value.
template<typename value_t>
auto operator= (value_t &&value) noexcept -> reference_wrapper_object &
 Assignment operator with specified xtd::reference_wrapper_object::base_type value.
 operator type & () const
 Gets the stored object.
 operator bool () const noexcept
 Checks if the stored reference is not empty.

Public Constructors

 reference_wrapper_object () noexcept=default
 Initializes a new instance of the xtd::reference_wrapper_object class.
 reference_wrapper_object (xtd::null_ptr null) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object class with specified null pointer.
template<typename value_t>
 reference_wrapper_object (value_t &&value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object class with specified reference.
 reference_wrapper_object (reference_wrapper_object &value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.
 reference_wrapper_object (const reference_wrapper_object &value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.
 reference_wrapper_object (reference_wrapper_object &&value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.
template<typename value_t>
 reference_wrapper_object (reference_wrapper_object< value_t > &value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.
template<typename value_t>
 reference_wrapper_object (const reference_wrapper_object< value_t > &value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.
template<typename value_t>
 reference_wrapper_object (reference_wrapper_object< value_t > &&value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.
 reference_wrapper_object (base_type &value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.
 reference_wrapper_object (const base_type &value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.
 reference_wrapper_object (base_type &&value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.
template<typename value_t>
 reference_wrapper_object (std::reference_wrapper< value_t > &value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.
template<typename value_t>
 reference_wrapper_object (const std::reference_wrapper< value_t > &value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.
template<typename value_t>
 reference_wrapper_object (std::reference_wrapper< value_t > &&value) noexcept
 Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.

Public Properties

auto is_empty () const noexcept -> bool
 Checks if the stored reference is empty.
auto reference () const -> const base_type &
 Returns the underlying base type reference.
auto reference () -> base_type &
 Returns the underlying base type reference.

Public Methods

auto compare_to (const reference_wrapper_object &obj) const noexcept -> xtd::int32 override
 Compares the current instance with another object of the same type.
auto equals (const xtd::object &value) const noexcept -> bool override
 Determines whether the specified object is equal to the current object.
auto equals (const reference_wrapper_object &value) const noexcept -> bool override
 Indicates whether the current object is equal to another object of the same type.
auto get () const -> type &
 Gets the stored reference.
auto get_hash_code () const noexcept -> xtd::usize override
 Serves as a hash function for a particular type.
auto reset () noexcept -> void
 Resets the current object. Set the current object to null.
template<typename value_t>
auto reset (value_t &&value) noexcept -> void
 Resets the current object. Set the current object with specified reference.
auto reset (xtd::null_ptr null) noexcept -> void
 Resets the current object. Set the current object with specified null value.
auto swap (reference_wrapper_object &value) noexcept -> void
 Swaps this current instance with specified reference object.
auto to_object () const -> type_t &
 Gets the stored object.
template<typename target_t>
auto to_object () const -> target_t
 Gets the stored object with specified target_t type.
auto to_reference () const -> type &
 Gets the stored reference.
template<typename target_t>
auto to_reference () const -> target_t
 Gets the stored reference with specified target_t type.
auto to_string () const noexcept -> xtd::string override
 Returns a xtd::string that represents the current object.

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
virtual auto get_type () const noexcept -> type_object
 Gets the type of the current instance.
template<typename object_t>
auto memberwise_clone () const -> xtd::unique_ptr_object< object_t >
 Creates a shallow copy of the current object.
virtual auto compare_to (const type_t &obj) const noexcept -> xtd::int32=0
 Compares the current instance with another object of the same type.
virtual auto equals (const type_t &) const noexcept -> bool=0
 Indicates whether the current object is equal to another object of the same type.
template<typename object_a_t, typename object_b_t>
static auto equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static auto reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are the same instance.

Member Typedef Documentation

◆ base_type

template<typename type_t>
using xtd::reference_wrapper_object< type_t >::base_type

Represents the base type (std::reference_wrapper<type_t>).

◆ type

template<typename type_t>
using xtd::reference_wrapper_object< type_t >::type

Represent the referenced type.

◆ reference_type

template<typename type_t>
using xtd::reference_wrapper_object< type_t >::reference_type

Represent the referenced type.

Constructor & Destructor Documentation

◆ reference_wrapper_object() [1/15]

template<typename type_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( )
defaultnoexcept

Initializes a new instance of the xtd::reference_wrapper_object class.

◆ reference_wrapper_object() [2/15]

template<typename type_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( xtd::null_ptr null)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object class with specified null pointer.

Parameters
nullThe null pointer.

◆ reference_wrapper_object() [3/15]

template<typename type_t>
template<typename value_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( value_t && value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object class with specified reference.

Parameters
valueThe reference.

◆ reference_wrapper_object() [4/15]

template<typename type_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( reference_wrapper_object< type_t > & value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [5/15]

template<typename type_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( const reference_wrapper_object< type_t > & value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [6/15]

template<typename type_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( reference_wrapper_object< type_t > && value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [7/15]

template<typename type_t>
template<typename value_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( reference_wrapper_object< value_t > & value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [8/15]

template<typename type_t>
template<typename value_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( const reference_wrapper_object< value_t > & value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [9/15]

template<typename type_t>
template<typename value_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( reference_wrapper_object< value_t > && value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [10/15]

template<typename type_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( base_type & value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [11/15]

template<typename type_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( const base_type & value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [12/15]

template<typename type_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( base_type && value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [13/15]

template<typename type_t>
template<typename value_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( std::reference_wrapper< value_t > & value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [14/15]

template<typename type_t>
template<typename value_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( const std::reference_wrapper< value_t > & value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.

Parameters
valueThe reference object.

◆ reference_wrapper_object() [15/15]

template<typename type_t>
template<typename value_t>
xtd::reference_wrapper_object< type_t >::reference_wrapper_object ( std::reference_wrapper< value_t > && value)
inlinenoexcept

Initializes a new instance of the xtd::reference_wrapper_object::base_type class with specified reference object.

Parameters
valueThe reference object.

Member Function Documentation

◆ is_empty()

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::is_empty ( ) const -> bool
inlinenodiscardnoexcept

Checks if the stored reference is empty.

Returns
trueif stored reference is empty; otherwise false.
Examples
The following code shows how to use xtd::reference_wrapper_object::get and xtd::reference_wrapper_object::is_empty
template<typename value_t>
void print_value(const reference_wrapper_object<value_t>& value) {
if (value.is_empty()) println("value is empty");
else println("value = {}", value.get());
}
auto println(FILE *file) -> void
Writes the current line terminator to the file output stream using the specified format information.
Definition println.hpp:14

◆ reference() [1/2]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::reference ( ) const -> const base_type &
inlinenodiscard

Returns the underlying base type reference.

Returns
The underlying base type reference.

◆ reference() [2/2]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::reference ( ) -> base_type &
inlinenodiscard

Returns the underlying base type reference.

Returns
The underlying base type reference.

◆ compare_to()

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::compare_to ( const reference_wrapper_object< type_t > & obj) const -> xtd::int32
inlinenodiscardoverridenoexcept

Compares the current instance with another object of the same type.

Parameters
objAn 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.

◆ equals() [1/2]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::equals ( const xtd::object & value) const -> bool
inlinenodiscardoverridevirtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe 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<typename type_t>
auto xtd::reference_wrapper_object< type_t >::equals ( const reference_wrapper_object< type_t > & value) const -> bool
inlinenodiscardoverridenoexcept

Indicates whether the current object is equal to another object of the same type.

Parameters
objAn object to compare with this object.
Returns
true if the current object is equal to the other parameter; otherwise, false.

◆ get()

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::get ( ) const -> type &
inlinenodiscard

Gets the stored reference.

Returns
The stored reference.
Exceptions
xtd::null_pointer_exceptionIf xtd::reference_wrapper_object is empty.
Examples
The following code shows how to use xtd::reference_wrapper_object::get and xtd::reference_wrapper_object::is_empty
template<typename value_t>
void print_value(const reference_wrapper_object<value_t>& value) {
if (value.is_empty()) println("value is empty");
else println("value = {}", value.get());
}

◆ get_hash_code()

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::get_hash_code ( ) const -> xtd::usize
inlinenodiscardoverridevirtualnoexcept

Serves as a hash function for a particular type.

Returns
A hash code for the current object.

Reimplemented from xtd::object.

◆ reset() [1/3]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::reset ( ) -> void
inlinenoexcept

Resets the current object. Set the current object to null.

Remarks
xtd::reference_wrapper_object::usecount property is decremented. If alias count equal 0 the object T is deleted.

◆ reset() [2/3]

template<typename type_t>
template<typename value_t>
auto xtd::reference_wrapper_object< type_t >::reset ( value_t && value) -> void
inlinenoexcept

Resets the current object. Set the current object with specified reference.

Parameters
valueThe reference to assign the current object. It can be null.
Remarks
xtd::reference_wrapper_object::usecount property is decremented. If alias count equal 0 the object T is deleted.

◆ reset() [3/3]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::reset ( xtd::null_ptr null) -> void
inlinenoexcept

Resets the current object. Set the current object with specified null value.

Parameters
nullThe null value.

◆ swap()

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::swap ( reference_wrapper_object< type_t > & value) -> void
inlinenoexcept

Swaps this current instance with specified reference object.

Parameters
valueThe reference object to swap with this current instance.

◆ to_object() [1/2]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::to_object ( ) const -> type_t &
inlinenodiscard

Gets the stored object.

Returns
The stored object.
Exceptions
xtd::null_pointer_exceptionIf xtd::reference_wrapper_object is empty.
Examples
The following code shows how to use xtd::reference_wrapper_object::to_object and xtd::reference_wrapper_object::is_empty
template<typename value_t>
void print_value(const reference_wrapper_object<value_t>& value) {
if (value.is_empty()) println("value is empty");
else println("value = {}", value.get());
}

◆ to_object() [2/2]

template<typename type_t>
template<typename target_t>
auto xtd::reference_wrapper_object< type_t >::to_object ( ) const -> target_t
nodiscard

Gets the stored object with specified target_t type.

Returns
The stored object.
Exceptions
xtd::cast_exceptionIf the current object can't be casted in target_t.

◆ to_reference() [1/2]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::to_reference ( ) const -> type &
inlinenodiscard

Gets the stored reference.

Returns
The stored reference.

◆ to_reference() [2/2]

template<typename type_t>
template<typename target_t>
auto xtd::reference_wrapper_object< type_t >::to_reference ( ) const -> target_t
nodiscard

Gets the stored reference with specified target_t type.

Returns
The stored reference.
Exceptions
xtd::cast_exceptionIf the current object can't be casted in target_t.

◆ to_string()

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::to_string ( ) const -> xtd::string
nodiscardoverridevirtualnoexcept

Returns a xtd::string that represents the current object.

Returns
A string that represents the current object.

Reimplemented from xtd::object.

◆ operator=() [1/11]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( const reference_wrapper_object< type_t > & value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object value.

Parameters
valueThe value to assign.

◆ operator=() [2/11]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( reference_wrapper_object< type_t > & value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object value.

Parameters
valueThe value to assign.

◆ operator=() [3/11]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( reference_wrapper_object< type_t > && value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object value.

Parameters
valueThe value to assign.

◆ operator=() [4/11]

template<typename type_t>
template<typename value_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( const reference_wrapper_object< value_t > & value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object value.

Parameters
valueThe value to assign.

◆ operator=() [5/11]

template<typename type_t>
template<typename value_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( reference_wrapper_object< value_t > & value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object value.

Parameters
valueThe value to assign.

◆ operator=() [6/11]

template<typename type_t>
template<typename value_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( reference_wrapper_object< value_t > && value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object value.

Parameters
valueThe value to assign.

◆ operator=() [7/11]

template<typename type_t>
template<typename value_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( const std::reference_wrapper< value_t > & value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object::base_type value.

Parameters
valueThe value to assign.

◆ operator=() [8/11]

template<typename type_t>
template<typename value_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( std::reference_wrapper< value_t > & value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object::base_type value.

Parameters
valueThe value to assign.

◆ operator=() [9/11]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( const base_type & value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object::base_type value.

Parameters
valueThe value to assign.

◆ operator=() [10/11]

template<typename type_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( base_type & value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object::base_type value.

Parameters
valueThe value to assign.

◆ operator=() [11/11]

template<typename type_t>
template<typename value_t>
auto xtd::reference_wrapper_object< type_t >::operator= ( value_t && value) -> reference_wrapper_object &
inlinenoexcept

Assignment operator with specified xtd::reference_wrapper_object::base_type value.

Parameters
valueThe value to assign.

◆ operator type &()

template<typename type_t>
xtd::reference_wrapper_object< type_t >::operator type & ( ) const
inline

Gets the stored object.

Returns
The stored object.
Exceptions
xtd::null_pointer_exceptionIf xtd::reference_wrapper_object is empty.
Examples
The following code shows how to use xtd::reference_wrapper_object::operator type& and xtd::reference_wrapper_object::is_empty
template<typename value_t>
void print_value(const reference_wrapper_object<value_t>& value) {
if (value.is_empty()) println("value is empty");
else println("value = {}", value.get());
}

◆ operator bool()

template<typename type_t>
xtd::reference_wrapper_object< type_t >::operator bool ( ) const
inlineexplicitnoexcept

Checks if the stored reference is not empty.

Returns
trueif stored reference is not empty; otherwise false.

Member Data Documentation

◆ empty

template<typename type_t>
const reference_wrapper_object xtd::reference_wrapper_object< type_t >::empty
static

Represents the empty xtd::reference_wrapper_object. This field is constant.


The documentation for this class was generated from the following file: