libfilezilla
|
Similar to C++17's std::optional, but stores the data in dynamic memory. More...
#include <optional.hpp>
Public Member Functions | |
sparse_optional (T const &v) | |
sparse_optional (T *v) noexcept | |
Takes ownership of pointer. | |
sparse_optional (sparse_optional< T > const &v) | |
sparse_optional (sparse_optional< T > &&v) noexcept | |
void | clear () |
operator bool () const | |
T & | operator* () |
T const & | operator* () const |
T * | operator-> () |
T const * | operator-> () const |
bool | operator== (sparse_optional< T > const &cmp) const |
bool | operator!= (sparse_optional< T > const &cmp) const |
bool | operator< (sparse_optional< T > const &cmp) const |
sparse_optional< T > & | operator= (sparse_optional< T > const &v) |
sparse_optional< T > & | operator= (sparse_optional< T > &&v) noexcept |
Similar to C++17's std::optional, but stores the data in dynamic memory.
sparse_optional is useful to save memory if it is expected that the object is rarely set and the object's size is bigger than a simple pointer.