mxnet
|
c++17 compatible optional class. More...
#include <optional.h>
Public Member Functions | |
optional () | |
construct an optional object that contains no value More... | |
optional (const T &value) | |
construct an optional object with value More... | |
optional (const optional< T > &other) | |
construct an optional object with another optional object More... | |
~optional () | |
deconstructor More... | |
void | swap (optional< T > &other) |
swap two optional More... | |
optional< T > & | operator= (const T &value) |
set this object to hold value More... | |
optional< T > & | operator= (const optional< T > &other) |
set this object to hold the same value with other More... | |
optional< T > & | operator= (nullopt_t) |
clear the value this object is holding. optional<T> x = nullopt; More... | |
T & | operator* () |
non-const dereference operator More... | |
const T & | operator* () const |
const dereference operator More... | |
bool | operator== (const optional< T > &other) const |
equal comparison More... | |
const T & | value () const |
return the holded value. throws std::logic_error if holding no value More... | |
operator bool () const | |
whether this object is holding a value More... | |
bool | has_value () const |
whether this object is holding a value (alternate form). More... | |
c++17 compatible optional class.
At any time an optional<T> instance either hold no value (string representation "None") or hold a value of type T.
|
inline |
construct an optional object that contains no value
|
inlineexplicit |
construct an optional object with value
|
inline |
construct an optional object with another optional object
|
inline |
deconstructor
|
inline |
whether this object is holding a value (alternate form).
|
inlineexplicit |
whether this object is holding a value
|
inline |
non-const dereference operator
|
inline |
const dereference operator
|
inline |
set this object to hold value
value | the value to hold |
|
inline |
set this object to hold the same value with other
other | the other object |
|
inline |
clear the value this object is holding. optional<T> x = nullopt;
|
inline |
equal comparison
|
inline |
swap two optional
|
inline |
return the holded value. throws std::logic_error if holding no value