Optional reference to an instance of type T.
More...
#include <eagine/optional_ref.hpp>
Public Member Functions | |
| optional_reference_wrapper (T &ref) noexcept | |
Construction from a reference to value of type T. | |
| optional_reference_wrapper (optional_reference_wrapper &&) noexcept=default | |
| Move constructor. | |
| optional_reference_wrapper (const optional_reference_wrapper &)=default | |
| Copy constructor. | |
| auto | operator= (optional_reference_wrapper &&) noexcept -> optional_reference_wrapper &=default |
| Move assignment operator. | |
| auto | operator= (const optional_reference_wrapper &) -> optional_reference_wrapper &=default |
| Copy assignment operator. | |
| constexpr | optional_reference_wrapper (nothing_t) noexcept |
| Construction from nothing. More... | |
| constexpr | optional_reference_wrapper (std::nullptr_t) noexcept |
| Construction from nullptr. More... | |
| auto | is_valid () const noexcept -> bool |
| Indicates if this stores a valid reference. | |
| operator bool () const noexcept | |
| Indicates if this stores a valid reference. More... | |
| auto | get () const noexcept -> T & |
| Returns the stored reference. More... | |
| auto | value () const noexcept -> const T & |
| Returns the stored value. More... | |
| template<typename U > | |
| auto | value_or (U &&fallback) const noexcept -> std::enable_if_t< std::is_convertible_v< U, T >, T > |
Returns the stored value if valid or fallback otherwise. More... | |
| operator T& () const noexcept | |
| Returns the stored reference. More... | |
Friends | |
| auto | operator== (const optional_reference_wrapper &l, const T &r) -> tribool |
| Tri-state equality comparison of the referred instance with a value. | |
| auto | operator!= (const optional_reference_wrapper &l, const T &r) -> tribool |
| Tri-state nonequality comparison of the referred instance with a value. | |
Optional reference to an instance of type T.
|
inlineconstexprnoexcept |
Construction from nothing.
|
inlineconstexprnoexcept |
Construction from nullptr.
|
inlinenoexcept |
Returns the stored reference.
Referenced by eagine::optional_reference_wrapper< T >::operator T&().
|
inlineexplicitnoexcept |
Indicates if this stores a valid reference.
|
inlineexplicitnoexcept |
Returns the stored reference.
|
inlinenoexcept |
Returns the stored value.
|
inlinenoexcept |
Returns the stored value if valid or fallback otherwise.