|
| | OptionalReference (T &value) |
| | Construct the optional wrapper from a real value.
|
| | OptionalReference (std::nullptr_t) |
| | Construct the optional wrapper from not-present value.
|
| T | value_or (T defaultValue) |
| | Returns a copy of the wrapped value if present or the provided default value if not.
|
| T & | value_or (T &defaultValue) |
| | Returns a reference to the wrapped value if present or the provided default value if not.
|
| auto | and_then (auto &&f) |
| | If this object holds a value then apply f to it and return the result, otherwise return the result of converting nullptr to the return type of f.
|
template<typename T>
class utils::OptionalReference< T >
A helper class modelled on std::optional that represents an optional T&.
This is stored as a pointer with nullptr representing the not-present version.
Unlike std::optional, this intentionally omits the APIs that make it possible to access the value without checking that it is present.
This is intended to be used as an alternative to using bare pointers to represent T& | None.
Definition at line 75 of file utils.hh.