Public Types | |
using | value_type = T |
The type of the value that may be inside the maybe. More... | |
Public Member Functions | |
bool | is_nothing () const BOND_NOEXCEPT |
Check if this object contains nothing. More... | |
operator bool () const BOND_NOEXCEPT | |
Check if this object contains a value. More... | |
void | set_nothing () BOND_NOEXCEPT |
Set to nothing. More... | |
template<typename... Args> | |
T & | emplace (Args &&... args) |
Construct a value in place. More... | |
T & | value () |
Get a reference to the value. More... | |
const T & | value () const |
Get a constant reference to the value. More... | |
T & | value (const std::nothrow_t &) BOND_NOEXCEPT |
Get a reference to the value. More... | |
const T & | value (const std::nothrow_t &) const BOND_NOEXCEPT |
Get a constant reference to the value. More... | |
maybe_common & | operator= (const maybe_common &)=default |
Assign from another maybe. More... | |
maybe_common & | operator= (maybe_common &&)=default |
Move assign from another maybe. More... | |
Friends | |
bool | operator== (const maybe_common &lhs, const T &rhs) |
Compares a maybe and a value for equality. More... | |
bool | operator!= (const maybe_common &lhs, const T &rhs) |
Compares a maybe and a value for inequality. More... | |
bool | operator== (const T &lhs, const maybe_common &rhs) |
Compares a value and a maybe for equality. More... | |
bool | operator!= (const T &lhs, const maybe_common &rhs) |
Compares and a value and a maybe for inequality. More... | |
Internal base class with shared implementation between the two maybe variants. Consult the documentation for bond::maybe<T> for its public interface.
using bond::detail::maybe_common< T >::value_type = T |
The type of the value that may be inside the maybe.
T & bond::detail::maybe_common< T >::emplace | ( | Args &&... | args | ) |
Construct a value in place.
bool bond::detail::maybe_common< T >::is_nothing | ( | ) | const |
Check if this object contains nothing.
|
explicit |
Check if this object contains a value.
|
default |
Assign from another maybe.
|
default |
Move assign from another maybe.
void bond::detail::maybe_common< T >::set_nothing | ( | ) |
Set to nothing.
T & bond::detail::maybe_common< T >::value | ( | ) |
Get a reference to the value.
CoreException | if the object contains nothing |
const T & bond::detail::maybe_common< T >::value | ( | ) | const |
Get a constant reference to the value.
CoreException | if the object contains nothing |
T & bond::detail::maybe_common< T >::value | ( | const std::nothrow_t & | ) |
Get a reference to the value.
Will never throw, but has undefined behavior if the object contains nothing.
const T & bond::detail::maybe_common< T >::value | ( | const std::nothrow_t & | ) | const |
Get a constant reference to the value.
Will never throw, but has undefined behavior if the object contains nothing.
|
friend |
Compares a maybe and a value for inequality.
See operator==(const maybe_common&,const T&) for details about how maybes holding nothing are handled.
|
friend |
Compares and a value and a maybe for inequality.
See operator==(const T&,const maybe_common&) for details about how maybes holding nothing are handled.
|
friend |
Compares a maybe and a value for equality.
|
friend |
Compares a value and a maybe for equality.