Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
optional< T > Class Template Reference
An optional type. More...
#include <optional.h>
Public Member Functions | |
optional () | |
Constructor. | |
optional (etl::nullopt_t) | |
Constructor with nullopt. | |
optional (const optional &other) | |
Copy constructor. | |
optional (const T &value_) | |
Constructor from value type. | |
~optional () | |
Destructor. | |
optional & | operator= (etl::nullopt_t) |
Assignment operator from nullopt. | |
optional & | operator= (const optional &other) |
Assignment operator from optional. | |
optional & | operator= (const T &value_) |
Assignment operator from value type. | |
T * | operator-> () |
Pointer operator. | |
const T * | operator-> () const |
Pointer operator. | |
T & | operator* () |
Dereference operator. | |
const T & | operator* () const |
Dereference operator. | |
operator bool () const | |
Bool conversion operator. | |
T & | value () |
Get a reference to the value. | |
const T & | value () const |
Get a const reference to the value. | |
T | value_or (T default_value) const |
Gets the value or a default if no valid. | |
void | swap (optional &other) |
Swaps this value with another. |
Detailed Description
template<typename T>
class etl::optional< T >
An optional type.
If the optional type is not initialised then a type is not constructed.
- Template Parameters:
-
The type to store.
Definition at line 104 of file optional.h.
Constructor & Destructor Documentation
optional | ( | ) |
Constructor.
Definition at line 111 of file optional.h.
Constructor with nullopt.
Definition at line 119 of file optional.h.
Copy constructor.
Definition at line 127 of file optional.h.
optional | ( | const T & | value_ ) |
Constructor from value type.
Definition at line 139 of file optional.h.
~optional | ( | ) |
Destructor.
Definition at line 148 of file optional.h.
Member Function Documentation
operator bool | ( | ) | const [explicit] |
Bool conversion operator.
Definition at line 268 of file optional.h.
T& operator* | ( | ) |
Dereference operator.
Definition at line 244 of file optional.h.
const T& operator* | ( | ) | const |
Dereference operator.
Definition at line 256 of file optional.h.
const T* operator-> | ( | ) | const |
Pointer operator.
Definition at line 232 of file optional.h.
T* operator-> | ( | ) |
Pointer operator.
Definition at line 220 of file optional.h.
Assignment operator from optional.
Definition at line 173 of file optional.h.
optional& operator= | ( | etl::nullopt_t | ) |
Assignment operator from nullopt.
Definition at line 159 of file optional.h.
optional& operator= | ( | const T & | value_ ) |
Assignment operator from value type.
Definition at line 202 of file optional.h.
void swap | ( | optional< T > & | other ) |
Swaps this value with another.
Definition at line 308 of file optional.h.
const T& value | ( | ) | const |
Get a const reference to the value.
Definition at line 288 of file optional.h.
T& value | ( | ) |
Get a reference to the value.
Definition at line 276 of file optional.h.
T value_or | ( | T | default_value ) | const |
Gets the value or a default if no valid.
Definition at line 300 of file optional.h.
Generated on Tue Jul 12 2022 14:05:53 by
