|
|
constexpr | maybe () noexcept=default |
| | Constructs an object that does not contain a value.
|
| |
| template<typename U , typename = typename std::enable_if< std::is_constructible<T, U &&>::value && !std::is_same<typename details::remove_cvref_t<U>, maybe<T>>::value>::type> |
| | maybe (U &&value) noexcept(std::is_nothrow_move_constructible< T >::value &&std::is_nothrow_copy_constructible< T >::value &&!std::is_convertible< U &&, T >::value) |
| | Constructs an optional object that contains a value, initialized with the expression std::forward<U>(value). More...
|
| |
|
template<typename... Args> |
| | maybe (in_place_t const inp, Args &&... args) |
| |
| | maybe (maybe const &other) noexcept(std::is_nothrow_copy_constructible< T >::value) |
| | Copy constructor: If other contains a value, initializes the contained value with the expression *other. More...
|
| |
| | maybe (maybe &&other) noexcept(std::is_nothrow_move_constructible< T >::value) |
| | Move constructor: If other contains a value, initializes the contained value with the expression std::move(*other) and does not make other empty: a moved-from optional still contains a value, but the value itself is moved from. More...
|
| |
|
void | reset () noexcept |
| | If *this contains a value, destroy it. *this does not contain a value after this call.
|
| |
|
maybe & | operator= (maybe const &other) noexcept(std::is_nothrow_copy_assignable< T >::value &&std::is_nothrow_copy_constructible< T >::value) |
| |
|
maybe & | operator= (maybe &&other) noexcept(std::is_nothrow_move_assignable< T >::value &&std::is_nothrow_move_constructible< T >::value) |
| |
|
template<typename U , typename = typename std::enable_if< std::is_constructible<T, U &&>::value && !std::is_same<typename details::remove_cvref_t<U>, maybe<T>>::value>::type> |
| maybe & | operator= (U &&other) noexcept(std::is_nothrow_copy_assignable< T >::value &&std::is_nothrow_copy_constructible< T >::value &&std::is_nothrow_move_assignable< T >::value &&std::is_nothrow_move_constructible< T >::value) |
| |
| template<typename... Args> |
| T & | emplace (Args &&... args) |
| | Constructs the contained value in-place. More...
|
| |
|
bool | operator== (maybe const &other) const |
| |
|
bool | operator!= (maybe const &other) const |
| |
|
T const & | operator* () const noexcept |
| | accesses the contained value
|
| |
|
T & | operator* () noexcept |
| | accesses the contained value
|
| |
|
T const * | operator-> () const noexcept |
| | accesses the contained value
|
| |
|
T * | operator-> () noexcept |
| | accesses the contained value
|
| |
|
constexpr | operator bool () const noexcept |
| | checks whether the object contains a value
|
| |
|
constexpr bool | has_value () const noexcept |
| | checks whether the object contains a value
|
| |
|
T const & | value () const noexcept |
| |
|
T & | value () noexcept |
| |
|
template<typename U > |
| constexpr T | value_or (U &&default_value) const |
| |
template<typename T, typename = typename std::enable_if<!std::is_reference<T>::value>::type>
template<typename U , typename = typename std::enable_if< std::is_constructible<T, U &&>::value && !std::is_same<typename details::remove_cvref_t<U>, maybe<T>>::value>::type>
Constructs an optional object that contains a value, initialized with the expression std::forward<U>(value).
template<typename T, typename = typename std::enable_if<!std::is_reference<T>::value>::type>
Copy constructor: If other contains a value, initializes the contained value with the expression *other.
If other does not contain a value, constructs an object that does not contain a value.
template<typename T, typename = typename std::enable_if<!std::is_reference<T>::value>::type>
Move constructor: If other contains a value, initializes the contained value with the expression std::move(*other) and does not make other empty: a moved-from optional still contains a value, but the value itself is moved from.
If other does not contain a value, constructs an object that does not contain a value.
template<typename T, typename = typename std::enable_if<!std::is_reference<T>::value>::type>
template<typename... Args>
Constructs the contained value in-place.
If *this already contains a value before the call, the contained value is destroyed by calling its destructor.
args... The arguments to pass to the constructor
- Returns
- A reference to the new contained value.