![]() |
F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
|
A type-safe container for an optional value. More...
#include <Fw/Types/Optional.hpp>
Public Member Functions | |
| constexpr | Optional () |
| Construct an empty Optional. More... | |
| constexpr | Optional (const None_t &a) |
| Construct an empty Optional from NONE sentinel. More... | |
| constexpr | Optional (const T &t) |
| Construct an Optional containing a value. More... | |
| Optional (const Optional &other) | |
| Copy constructor. More... | |
| ~Optional ()=default | |
| Destructor (trivial — T must be trivially copyable) More... | |
| bool | has_value () const |
| T & | value () |
| const T & | value () const |
| T | value_or (const T &default_value) const |
| void | reset () |
| Reset the Optional to an empty state. More... | |
| Optional & | operator= (const T &t) |
| Assign a value into the Optional. More... | |
| Optional & | operator= (const None_t &a) |
| Reset the Optional via NONE assignment. More... | |
| Optional & | operator= (const Optional &other) |
| Copy assignment operator. More... | |
| bool | operator== (const None_t &a) const |
| Compare with NONE sentinel. More... | |
| bool | operator!= (const None_t &a) const |
| Compare with NONE sentinel (inequality) More... | |
| bool | operator== (const Optional &other) const |
| Equality comparison with another Optional. More... | |
| bool | operator!= (const Optional &other) const |
| Inequality comparison with another Optional. More... | |
A type-safe container for an optional value.
Provides a C++14-compatible alternative to std::optional. Only supports trivially copyable types (no non-trivial constructors, destructors, or copy/move operators).
| T | The type of the contained value. Must be trivially copyable. |
Definition at line 43 of file Optional.hpp.
|
inline |
Construct an empty Optional.
Definition at line 55 of file Optional.hpp.
|
inline |
Construct an empty Optional from NONE sentinel.
Definition at line 58 of file Optional.hpp.
|
inline |
Construct an Optional containing a value.
Definition at line 61 of file Optional.hpp.
|
inline |
Copy constructor.
Definition at line 64 of file Optional.hpp.
|
default |
Destructor (trivial — T must be trivially copyable)
|
inline |
Check whether the Optional contains a value
Definition at line 79 of file Optional.hpp.
|
inline |
Compare with NONE sentinel (inequality)
Definition at line 147 of file Optional.hpp.
|
inline |
Inequality comparison with another Optional.
Definition at line 164 of file Optional.hpp.
|
inline |
Assign a value into the Optional.
Definition at line 113 of file Optional.hpp.
|
inline |
Reset the Optional via NONE assignment.
Definition at line 120 of file Optional.hpp.
|
inline |
Copy assignment operator.
Definition at line 127 of file Optional.hpp.
|
inline |
Compare with NONE sentinel.
Definition at line 141 of file Optional.hpp.
|
inline |
Equality comparison with another Optional.
Definition at line 153 of file Optional.hpp.
|
inline |
Reset the Optional to an empty state.
Definition at line 106 of file Optional.hpp.
|
inline |
Access the contained value
Definition at line 84 of file Optional.hpp.
|
inline |
Access the contained value (const)
Definition at line 92 of file Optional.hpp.
|
inline |
Access the value or return a default
Definition at line 99 of file Optional.hpp.