|
libhatchet
|
#include <hxref.hpp>
Public Types | |
| using | value_t = T& |
Public Member Functions | |
| hxref (void) | |
| hxref (hxnil_t) | |
| template<typename U_, hxenable_if_t< !hxis_hxref_< hxremove_cvref_t< U_ > >::value &&!hxis_hxexpected_< hxremove_cvref_t< U_ > >::value &&hxbinds_directly< T, U_ >(), bool > = true> | |
| hxref (U_ &value_) | |
| template<typename E_> | |
| hxref (hxexpected< T, E_ > &x_) | |
| T & | operator* (void) const |
| T * | operator-> (void) const |
| operator bool (void) const | |
| hxref & | operator= (hxnil_t) |
| template<typename U_, hxenable_if_t< !hxis_hxref_< hxremove_cvref_t< U_ > >::value &&!hxis_hxexpected_< hxremove_cvref_t< U_ > >::value &&hxbinds_directly< T, U_ >(), bool > = true> | |
| hxref & | operator= (U_ &value_) |
| bool | operator== (const hxref &x_) const |
| bool | operator== (hxnil_t) const |
| bool | operator== (const T &value_) const |
| template<typename self_t_, typename callable_t_> | |
| auto | and_then (this self_t_ &&self_, callable_t_ &&callable_) -> hxremove_cvref_t< decltype(hxforward< callable_t_ >(callable_)(hxdeclval< T & >()))> |
| bool | equal (const hxref &x_) const |
| bool | has_value (void) const |
| hxhash_t | hash (void) const |
| template<typename self_t_, typename callable_t_> | |
| hxref | or_else (this self_t_ &&self_, callable_t_ &&callable_) |
| void | reset (void) |
| void | swap (hxref &x_) noexcept |
| T & | value (void) const |
| template<typename self_t_, typename... args_t_> | |
| hxremove_cv_t< T > | value_or (this self_t_ &&self_, args_t_ &&... args_) |
hxref<T> - Holds a reference to a value of type T, or null.
Implements the non-owning pointer std::optional<T&>. A null reference compares equal to hxnil. Assignment rebinds the reference instead of assigning through to the referent, matching pointer semantics. Use hxref<const T> where write through should be prevented.
| using hxref< T >::value_t = T& |
value_type - Publishes the referenced value type.
Doesn't end with _t because of the standard.
| hxref< T >::hxref | ( | U_ & | value_ | ) |
Binds a reference to the value of x.
Accepts an non-null or erroneous hxexpected<T, E>.
| auto hxref< T >::and_then | ( | this self_t_ && | self_, |
| callable_t_ && | callable_ )->hxremove_cvref_t< decltype(hxforward< callable_t_ >(callable_)(hxdeclval< T & >()))> |
Returns the result of calling callable with the referenced value if non-null, otherwise returns hxnil.
Use and_then to return hxptr, hxref or hxexpected.
Returns true if both references are null or both reference equal values.
|
inline |
Returns true if the reference is non-null.
Returns the hash of the referenced value if non-null, otherwise 31u.
|
inlineexplicit |
Returns true if the reference is non-null.
| T & hxref< T >::operator* | ( | void | ) | const |
Returns a reference to the referenced value.
The reference must be non-null.
| T * hxref< T >::operator-> | ( | void | ) | const |
Returns a pointer to the referenced value.
The reference must be non-null.
| hxref & hxref< T >::operator= | ( | U_ & | value_ | ) |
Returns true if both references are null or both reference equal values.
| bool hxref< T >::operator== | ( | const T & | value_ | ) | const |
Returns true if this reference is null.
| hxref hxref< T >::or_else | ( | this self_t_ && | self_, |
| callable_t_ && | callable_ ) |
Returns a copy of this reference if non-null, otherwise returns the result of calling callable.
callable must return an hxref<T>. Implements std::optional::or_else.
|
inline |
Nulls the reference. The referent is not affected.
Exchanges the bound pointers with x.
| T & hxref< T >::value | ( | void | ) | const |
Returns a reference to the referenced value.
The reference must be non-null.
| hxremove_cv_t< T > hxref< T >::value_or | ( | this self_t_ && | self_, |
| args_t_ &&... | args_ ) |
Returns the referenced value if non-null, otherwise returns a T constructed from args.