|
TinyRobotics
|
Minimal header-only polyfill for std::optional for pre-C++17 environments. More...
#include <Optional.h>
Public Member Functions | |
| optional (nullopt_t) noexcept | |
| optional (const T &value) | |
| optional (T &&value) | |
| optional (const optional &other) | |
| optional (optional &&other) noexcept | |
| optional & | operator= (nullopt_t) noexcept |
| optional & | operator= (const optional &other) |
| optional & | operator= (optional &&other) noexcept |
| bool | has_value () const noexcept |
| operator bool () const noexcept | |
| T & | value () |
| const T & | value () const |
| T | value_or (const T &default_value) const |
| void | reset () |
Minimal header-only polyfill for std::optional for pre-C++17 environments.
This implementation provides the basic interface of std::optional, allowing code to use std::optional<T> and std::nullopt in environments where the standard library version is not available.
Features:
Limitations:
Usage: