Basic implementation of optional, reference impl ( https://github.com/akrzemi1/Optional ) cannot be used, as it doesn't support MSVC2013.
More...
#include <staticlib/support/optional.hpp>
Public Member Functions |
| | optional () |
| | Constructs empty instance.
|
| | optional (T &&value) |
| | Constructor.
|
| | optional (const optional &) |
| | Deleted copy constructor.
|
| optional & | operator= (const optional &) |
| | Deleted copy assignment operator.
|
| | optional (optional &&other) STATICLIB_NOEXCEPT |
| | Move constructor.
|
| optional & | operator= (optional &&other) STATICLIB_NOEXCEPT |
| | Move assignment operator.
|
| | ~optional () STATICLIB_NOEXCEPT |
| | Destructor.
|
| | operator bool () const |
| | Overloaded bool operator.
|
| bool | has_value () const |
| | Check whether this instance stores value.
|
| T & | value () |
| | Access stored value.
|
| const T & | value () const |
| | Access stored value.
|
| T | value_or (T &&default_value) const |
| | Access stored value; value will be copied out.
|
| T | value_or (T &&default_value) |
| | Access stored value; value will be moved out of this instance and remaining value will be in "valid, but unspecified state".
|
| void | reset () |
| | Destructs stored value if any.
|
Detailed Description
template<typename T>
class staticlib::support::optional< T >
Basic implementation of optional, reference impl ( https://github.com/akrzemi1/Optional ) cannot be used, as it doesn't support MSVC2013.
Constructor & Destructor Documentation
Constructs empty instance.
Constructor.
- Parameters
-
| value | to store in this instance |
Deleted copy constructor.
Move constructor.
- Parameters
-
Member Function Documentation
Check whether this instance stores value.
- Returns
- true if this instance stores value, false otherwise
Overloaded bool operator.
- Returns
- true if this instance stores value, false otherwise
Deleted copy assignment operator.
Move assignment operator.
- Parameters
-
- Returns
- this instance
Destructs stored value if any.
Access stored value.
- Returns
- value reference
- Exceptions
-
Access stored value.
- Returns
- value const reference
- Exceptions
-
Access stored value; value will be copied out.
- Parameters
-
| default_value | default value |
- Returns
- stored value if has one, default value otherwise
Access stored value; value will be moved out of this instance and remaining value will be in "valid, but unspecified state".
- Parameters
-
| default_value | default value |
- Returns
- stored value if has one, default value otherwise
The documentation for this class was generated from the following file: