|
|
| optional (const none_t &=none) |
| | Creates an instance without value.
|
| |
|
template<class U , class E = typename std::enable_if< std::is_convertible<U, T>::value >::type> |
| | optional (U x) |
| | Creates an valid instance from value.
|
| |
|
| optional (const optional &other) |
| |
|
| optional (optional &&other) noexcept(std::is_nothrow_move_constructible< T >::value) |
| |
|
optional & | operator= (const optional &other) |
| |
|
optional & | operator= (optional &&other) noexcept(std::is_nothrow_destructible< T >::value &&std::is_nothrow_move_assignable< T >::value) |
| |
|
| operator bool () const |
| | Checks whether this object contains a value.
|
| |
|
bool | operator! () const |
| | Checks whether this object does not contain a value.
|
| |
|
T & | operator* () |
| | Returns the value.
|
| |
|
const T & | operator* () const |
| | Returns the value.
|
| |
|
const T * | operator-> () const |
| | Returns the value.
|
| |
|
T * | operator-> () |
| | Returns the value.
|
| |
|
T & | value () |
| | Returns the value.
|
| |
|
const T & | value () const |
| | Returns the value.
|
| |
|
const T & | value_or (const T &default_value) const |
| | Returns the value if m_valid, otherwise returns default_value.
|
| |
|
(Note that these are not member functions.)
|
| template<class T > |
| std::string | to_string (const optional< T > &x) |
| |
|
template<class T > |
| T && | move_if_optional (optional< T > &x) |
| | Returns an rvalue to the value managed by x.
|
| |
|
template<class T > |
| T & | move_if_optional (T *x) |
| | Returns *x.
|
| |
| template<class T > |
| bool | operator== (const optional< T > &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator!= (const optional< T > &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator< (const optional< T > &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator<= (const optional< T > &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator>= (const optional< T > &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator> (const optional< T > &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator== (const optional< T > &lhs, none_t) |
| |
| template<class T > |
| bool | operator== (none_t, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator!= (const optional< T > &lhs, none_t) |
| |
| template<class T > |
| bool | operator!= (none_t, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator< (const optional< T > &, none_t) |
| |
| template<class T > |
| bool | operator< (none_t, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator<= (const optional< T > &lhs, none_t) |
| |
| template<class T > |
| bool | operator<= (none_t, const optional< T > &) |
| |
| template<class T > |
| bool | operator> (const optional< T > &lhs, none_t) |
| |
| template<class T > |
| bool | operator> (none_t, const optional< T > &) |
| |
| template<class T > |
| bool | operator>= (const optional< T > &, none_t) |
| |
| template<class T > |
| bool | operator>= (none_t, const optional< T > &) |
| |
| template<class T > |
| bool | operator== (const optional< T > &lhs, const T &rhs) |
| |
| template<class T > |
| bool | operator== (const T &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator!= (const optional< T > &lhs, const T &rhs) |
| |
| template<class T > |
| bool | operator!= (const T &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator< (const optional< T > &lhs, const T &rhs) |
| |
| template<class T > |
| bool | operator< (const T &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator<= (const optional< T > &lhs, const T &rhs) |
| |
| template<class T > |
| bool | operator<= (const T &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator> (const optional< T > &lhs, const T &rhs) |
| |
| template<class T > |
| bool | operator> (const T &lhs, const optional< T > &rhs) |
| |
| template<class T > |
| bool | operator>= (const optional< T > &lhs, const T &rhs) |
| |
| template<class T > |
| bool | operator>= (const T &lhs, const optional< T > &rhs) |
| |
template<class T>
class caf::optional< T >
A C++17 compatible optional implementation.