|
ModErn Text Analysis
META Enumerates Textual Applications
|
A class for representing optional values. More...
#include <optional.h>
Public Member Functions | |
| optional () | |
| Default constructor, creates a disengaged optional value. | |
| optional (nullopt_t) | |
| Conversion constructor from nullopt, creates a disengaged optional value. | |
| optional (const T &value) | |
| Creates an optional value with the given contents. More... | |
| optional (T &&value) | |
| Creates an optional value with the given contents via move construction. More... | |
| optional (const optional &) | |
| Copy constructor. | |
| optional (optional &&) | |
| Move constructor. | |
| optional & | operator= (optional) |
| Assignment operator. | |
| ~optional () | |
| Destructor. More... | |
| void | swap (optional &other) |
| Swaps the current optional instance with the parameter. More... | |
| const T & | operator* () const |
| Obtains the value contained in the optional. More... | |
| T & | operator* () |
| Obtains the value contained in the optional. More... | |
| const T * | operator-> () const |
| Member access operator to the value contained in the optional. More... | |
| T * | operator-> () |
| Member access operator to the value contained in the optional. More... | |
| operator bool () const | |
| void | clear () |
| Empties the optional. | |
Private Member Functions | |
| const T * | dataptr () const |
| Helper function to obtain the address of the contained value. More... | |
| T * | dataptr () |
| Helper function to obtain the address of the contained value. More... | |
Private Attributes | |
| bool | initialized_ |
| Whether or not this optional is engaged. | |
| optional_storage< T > | storage_ |
| The storage for this optional. | |
A class for representing optional values.
This is a very naiive approach based on the design given in the WG21 paper and the reference implementation. Many features of the real optional<T> design there are not supported here—this is a lightweight replacement until C++14 is completed and implemented in compilers.
| meta::util::optional< T >::optional | ( | const T & | value | ) |
Creates an optional value with the given contents.
| value | the desired value to be contained in the optional |
| meta::util::optional< T >::optional | ( | T && | value | ) |
Creates an optional value with the given contents via move construction.
| value | the desired value to be moved into the optional |
| meta::util::optional< T >::~optional | ( | ) |
Destructor.
Responsible for ensuring the proper destruction of the contained type, if it is engaged.
| void meta::util::optional< T >::swap | ( | optional< T > & | other | ) |
Swaps the current optional instance with the parameter.
| other | the optional to swap with |
| const T & meta::util::optional< T >::operator* | ( | ) | const |
Obtains the value contained in the optional.
Const version.
| T & meta::util::optional< T >::operator* | ( | ) |
Obtains the value contained in the optional.
Non-const version.
| const T * meta::util::optional< T >::operator-> | ( | ) | const |
Member access operator to the value contained in the optional.
Const version.
| T * meta::util::optional< T >::operator-> | ( | ) |
Member access operator to the value contained in the optional.
Non-const version.
|
explicit |
|
private |
Helper function to obtain the address of the contained value.
const version.
|
private |
Helper function to obtain the address of the contained value.
non-const version.
1.8.9.1