|
ForestHub SDK 0.1.0
C++14 LLM SDK for PC and embedded platforms
|
Minimal Optional<T> polyfill for C++14 compatibility. More...
#include <optional.hpp>
Public Member Functions | |
| Optional ()=default | |
| Default-construct without a stored value. | |
| Optional (const T &val) | |
| Construct with a copy of the given value. | |
| Optional (T &&val) | |
| Construct by moving the given value. | |
| bool | HasValue () const |
| Returns true if a value is stored. | |
| operator bool () const | |
| Contextual conversion to bool (true if a value is stored). | |
| const T & | operator* () const |
| Returns a reference to the stored value (undefined if empty). | |
| T & | operator* () |
| Returns a mutable reference to the stored value (undefined if empty). | |
| const T * | operator-> () const |
| Returns a pointer to the stored value (undefined if empty). | |
| T * | operator-> () |
| Returns a mutable pointer to the stored value (undefined if empty). | |
| Optional & | operator= (const T &val) |
| Assign a value (sets has_value to true). | |
| Optional & | operator= (T &&val) |
| Move-assign a value (sets has_value to true). | |
Public Attributes | |
| bool | has_value = false |
| Whether a value is stored. | |
| T | value {} |
| Stored value (default-constructed when empty). | |
Minimal Optional<T> polyfill for C++14 compatibility.
Used for non-string optional fields (int, float, structs) where a default/zero value would be ambiguous. String-type optional fields should use plain std::string (empty = not set).