![]() |
Spicy
|
#include <optional-ref.h>
Public Types | |
using | nonConstT = typename std::remove_const< T >::type |
Public Member Functions | |
optional_ref (const optional_ref< T > &other)=default | |
optional_ref (optional_ref< T > &&other) noexcept=default | |
optional_ref (std::nullopt_t) | |
optional_ref (T &other) | |
optional_ref (T &&other)=delete | |
bool | has_value () const |
T & | value () const |
T & | value_or (T &default_) const |
void | reset () |
T * | operator-> () const |
T & | operator* () const |
optional_ref & | operator= (const optional_ref< T > &other)=default |
optional_ref & | operator= (optional_ref< T > &&other) noexcept=default |
optional_ref & | operator= (std::nullopt_t) |
optional_ref & | operator= (T &t) |
optional_ref & | operator= (T &&t)=delete |
operator bool () const | |
bool | operator== (const optional_ref< T > &other) const |
bool | operator!= (const optional_ref< T > &other) const |
operator std::optional< nonConstT > () const | |
Similar to std::optional<>T
but storing a reference to the wrapped instance instead of a full copy. The caller must ensure that the underlying instance remains valid as long as necessary.