#include <optional.hpp>
Public Types | |
typedef T | value_type |
Public Member Functions | |
optional ()=default | |
optional (detail::nullopt_t) | |
optional (const T &value) | |
template<class U > | |
optional (const optional< U > &x) | |
optional & | operator= (detail::nullopt_t) |
template<class U > | |
optional & | operator= (const optional< U > &x) |
const value_type * | operator-> () const |
value_type * | operator-> () |
const value_type & | operator* () const |
value_type & | operator* () |
operator bool () const | |
const value_type & | value () const |
value_type & | value () |
template<class U > | |
value_type | value_or (U const &v) const |
bool | has_value () const |
void | reset () |
The optional class provides an object holding a value of type T or not. The value is optional.
T | Type of the hold optional value |
typedef T matador::optional< T >::value_type |
Shortcut to the value type
|
default |
Default constructor
|
inline |
Initializes the optional with a null type.
|
inline |
Initializes a new optional with the given value.
value | Value of optional |
|
inline |
Copies given optional value x of type U to new optional value of type T. A value of type U must be convertible to type T.
U | Type of other optional |
x | Other optional value |
|
inline |
Returns true if value is set.
|
inlineexplicit |
Boolean operator returns true if optional has a value
|
inline |
Access the underlying value as reference. The value is checked on validity with assert
|
inline |
Access the underlying value as reference. The value is checked on validity with assert
|
inline |
Access the underlying value as pointer. The value is checked on validity with assert
|
inline |
Access the underlying value as pointer. The value is checked on validity with assert
|
inline |
Assigns an other optional of type U to this optional. Type U must be convertible to type T.
U | Type of other optional |
x | Other optional to be assigned |
|
inline |
Assigns a null optional value to this optional. Optional will be set to nullopt.
|
inline |
Resets optional to empty (no value set)
|
inline |
Returns a reference to the value. If value isn't available a bad_optional_exception is thrown
bad_optional_exception | If not available |
|
inline |
Returns a const reference to the value. If value isn't available a bad_optional_exception is thrown
bad_optional_exception | If not available |
|
inline |
Return a copy of the value or in case value is not set return the given value
This default value is of type U and must be convertible to type T.
U | Type of default value |
v | Default value if optional value is not set |