An implementation of optional for C++11, which aims to be compatible with a subset of std::optional features. More...
#include <Optional.h>
Public Member Functions | |
Optional () noexcept | |
Optional (nullopt_t) noexcept | |
Optional (const T &value) noexcept | |
Optional (const Optional< T > &other) noexcept | |
void | operator= (nullopt_t) noexcept |
void | operator= (const Optional< T > &other) noexcept |
T & | value () |
const T & | value () const |
const T & | value_or (const T &def) const |
bool | has_value () const noexcept |
operator bool () const | |
Private Attributes | |
bool | m_has_value = false |
T | m_value |
An implementation of optional for C++11, which aims to be compatible with a subset of std::optional features.
Unfortunately, Minetest doesn't use C++17 yet.
T | The type to be stored |
|
inlinenoexcept |
References Optional< T >::m_has_value.
|
inlineexplicit |
References Optional< T >::m_has_value.
References Optional< T >::m_has_value, and Optional< T >::m_value.
References Optional< T >::m_has_value.
|
inline |
References FATAL_ERROR_IF, Optional< T >::m_has_value, and Optional< T >::m_value.
Referenced by Nametag::getBgColor(), ObjectRef::l_get_nametag_attributes(), push_object_properties(), and ObjectProperties::serialize().
|
inline |
References FATAL_ERROR_IF, Optional< T >::m_has_value, and Optional< T >::m_value.
|
inline |
References Optional< T >::m_has_value, and Optional< T >::m_value.
|
private |
|
private |
Referenced by Optional< T >::operator=(), Optional< T >::value(), and Optional< T >::value_or().