|
template<class F > |
TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t< F, T & > | and_then (F &&f) & |
|
template<class F > |
TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t< F, T & > | and_then (F &&f) && |
|
template<class F > |
constexpr detail::invoke_result_t< F, const T & > | and_then (F &&f) const & |
|
template<class F > |
constexpr detail::invoke_result_t< F, const T & > | and_then (F &&f) const && |
|
template<class F > |
TL_OPTIONAL_11_CONSTEXPR decltype(detail::optional_map_impl(std::declval< optional & >(), std::declval< F && >())) | map (F &&f) & |
| Carries out some operation on the stored object if there is one.
|
|
template<class F > |
TL_OPTIONAL_11_CONSTEXPR decltype(detail::optional_map_impl(std::declval< optional && >(), std::declval< F && >())) | map (F &&f) && |
|
template<class F > |
constexpr decltype(detail::optional_map_impl(std::declval< const optional & >(), std::declval< F && >())) | map (F &&f) const & |
|
template<class F > |
constexpr decltype(detail::optional_map_impl(std::declval< const optional && >(), std::declval< F && >())) | map (F &&f) const && |
|
template<class F > |
TL_OPTIONAL_11_CONSTEXPR decltype(detail::optional_map_impl(std::declval< optional & >(), std::declval< F && >())) | transform (F &&f) & |
| Carries out some operation on the stored object if there is one.
|
|
template<class F > |
TL_OPTIONAL_11_CONSTEXPR decltype(detail::optional_map_impl(std::declval< optional && >(), std::declval< F && >())) | transform (F &&f) && |
|
template<class F > |
constexpr decltype(detail::optional_map_impl(std::declval< const optional & >(), std::declval< F && >())) | transform (F &&f) const & |
|
template<class F > |
constexpr decltype(detail::optional_map_impl(std::declval< const optional && >(), std::declval< F && >())) | transform (F &&f) const && |
|
template<class F , detail::enable_if_ret_void< F > * = nullptr> |
optional< T > TL_OPTIONAL_11_CONSTEXPR | or_else (F &&f) & |
| Calls f if the optional is empty.
|
|
template<class F , detail::disable_if_ret_void< F > * = nullptr> |
optional< T > TL_OPTIONAL_11_CONSTEXPR | or_else (F &&f) & |
|
template<class F , detail::enable_if_ret_void< F > * = nullptr> |
optional< T > | or_else (F &&f) && |
|
template<class F , detail::disable_if_ret_void< F > * = nullptr> |
optional< T > TL_OPTIONAL_11_CONSTEXPR | or_else (F &&f) && |
|
template<class F , detail::enable_if_ret_void< F > * = nullptr> |
optional< T > | or_else (F &&f) const & |
|
template<class F , detail::disable_if_ret_void< F > * = nullptr> |
optional< T > TL_OPTIONAL_11_CONSTEXPR | or_else (F &&f) const & |
|
template<class F , detail::enable_if_ret_void< F > * = nullptr> |
optional< T > | or_else (F &&f) const && |
|
template<class F , detail::disable_if_ret_void< F > * = nullptr> |
optional< T > | or_else (F &&f) const && |
|
template<class F , class U > |
U | map_or (F &&f, U &&u) & |
| Maps the stored value with f if there is one, otherwise returns u
|
|
template<class F , class U > |
U | map_or (F &&f, U &&u) && |
|
template<class F , class U > |
U | map_or (F &&f, U &&u) const & |
|
template<class F , class U > |
U | map_or (F &&f, U &&u) const && |
|
template<class F , class U > |
detail::invoke_result_t< U > | map_or_else (F &&f, U &&u) & |
|
template<class F , class U > |
detail::invoke_result_t< U > | map_or_else (F &&f, U &&u) && |
|
template<class F , class U > |
detail::invoke_result_t< U > | map_or_else (F &&f, U &&u) const & |
|
template<class F , class U > |
detail::invoke_result_t< U > | map_or_else (F &&f, U &&u) const && |
|
template<class U > |
constexpr optional< typename std::decay< U >::type > | conjunction (U &&u) const |
| Returns u if *this has a value, otherwise an empty optional.
|
|
TL_OPTIONAL_11_CONSTEXPR optional | disjunction (const optional &rhs) & |
| Returns rhs if *this is empty, otherwise the current value.
|
|
constexpr optional | disjunction (const optional &rhs) const & |
|
TL_OPTIONAL_11_CONSTEXPR optional | disjunction (const optional &rhs) && |
|
constexpr optional | disjunction (const optional &rhs) const && |
|
TL_OPTIONAL_11_CONSTEXPR optional | disjunction (optional &&rhs) & |
|
constexpr optional | disjunction (optional &&rhs) const & |
|
TL_OPTIONAL_11_CONSTEXPR optional | disjunction (optional &&rhs) && |
|
constexpr optional | disjunction (optional &&rhs) const && |
|
optional | take () |
| Takes the value out of the optional, leaving it empty.
|
|
constexpr | optional () noexcept |
| Constructs an optional that does not contain a value.
|
|
constexpr | optional (nullopt_t) noexcept |
|
TL_OPTIONAL_11_CONSTEXPR | optional (const optional &rhs) noexcept=default |
|
TL_OPTIONAL_11_CONSTEXPR | optional (optional &&rhs)=default |
|
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U > >::value > * = nullptr> |
constexpr | optional (U &&u) noexcept |
| Constructs the stored value with u .
|
|
template<class U > |
constexpr | optional (const optional< U > &rhs) noexcept |
|
| ~optional ()=default |
| No-op.
|
|
optional & | operator= (nullopt_t) noexcept |
|
optional & | operator= (const optional &rhs)=default |
|
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U > >::value > * = nullptr> |
optional & | operator= (U &&u) |
| Rebinds this optional to u .
|
|
template<class U > |
optional & | operator= (const optional< U > &rhs) noexcept |
|
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U > >::value > * = nullptr> |
optional & | emplace (U &&u) noexcept |
| Rebinds this optional to u .
|
|
void | swap (optional &rhs) noexcept |
|
constexpr const T * | operator-> () const noexcept |
| Returns a pointer to the stored value.
|
|
TL_OPTIONAL_11_CONSTEXPR T * | operator-> () noexcept |
|
TL_OPTIONAL_11_CONSTEXPR T & | operator* () noexcept |
| Returns the stored value.
|
|
constexpr const T & | operator* () const noexcept |
|
constexpr bool | has_value () const noexcept |
|
constexpr | operator bool () const noexcept |
|
TL_OPTIONAL_11_CONSTEXPR T & | value () |
| Returns the contained value if there is one, otherwise throws bad_optional_access.
|
|
TL_OPTIONAL_11_CONSTEXPR const T & | value () const |
|
template<class U > |
constexpr T | value_or (U &&u) const &noexcept |
| Returns the stored value if there is one, otherwise returns u
|
|
template<class U > |
TL_OPTIONAL_11_CONSTEXPR T | value_or (U &&u) &&noexcept |
| \group value_or
|
|
void | reset () noexcept |
| Destroys the stored value if one exists, making the optional empty.
|
|
template<class T>
class m5::stl::optional< T & >
Specialization for when T
is a reference. optional<T&>
acts similarly to a T*
, but provides more operations and shows intent more clearly.