|
Libsaki
Core library of Pancake Mahjong
|
#include <sol.hpp>
Public Types | |
| using | value_type = T & |
Public Member Functions | |
| template<class F > | |
| SOL_TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t< F, T & > | and_then (F &&f) & |
| template<class F > | |
| SOL_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 , detail::enable_if_ret_void< F > * = nullptr> | |
| optional< T > SOL_TL_OPTIONAL_11_CONSTEXPR | or_else (F &&f) & |
Calls f if the optional is empty std::invoke_result_t<F> must be void or convertible to optional<T>. If *this has a value, returns *this. Otherwise, if f returns void, calls std::forward<F>(f) and returns std::nullopt. Otherwise, returns std::forward<F>(f)(). More... | |
| template<class F , detail::disable_if_ret_void< F > * = nullptr> | |
| optional< T > SOL_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 > SOL_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 > SOL_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. More... | |
| template<class F , class U > | |
| U | map_or (F &&f, U &&u) && |
| map_or | |
| template<class F , class U > | |
| U | map_or (F &&f, U &&u) const & |
| map_or | |
| template<class F , class U > | |
| U | map_or (F &&f, U &&u) const && |
| map_or | |
| template<class F , class U > | |
| detail::invoke_result_t< U > | map_or_else (F &&f, U &&u) & |
Maps the stored value with f if there is one, otherwise calls u and returns the result. More... | |
| 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 |
| SOL_TL_OPTIONAL_11_CONSTEXPR optional | disjunction (const optional &rhs) & |
| constexpr optional | disjunction (const optional &rhs) const & |
| disjunction | |
| SOL_TL_OPTIONAL_11_CONSTEXPR optional | disjunction (const optional &rhs) && |
| disjunction | |
| constexpr optional | disjunction (const optional &rhs) const && |
| disjunction | |
| SOL_TL_OPTIONAL_11_CONSTEXPR optional | disjunction (optional &&rhs) & |
| disjunction | |
| constexpr optional | disjunction (optional &&rhs) const & |
| disjunction | |
| SOL_TL_OPTIONAL_11_CONSTEXPR optional | disjunction (optional &&rhs) && |
| disjunction | |
| constexpr optional | disjunction (optional &&rhs) const && |
| disjunction | |
| optional | take () & |
| optional | take () const & |
| take | |
| optional | take () && |
| take | |
| optional | take () const && |
| take | |
| constexpr | optional () noexcept |
| constexpr | optional (nullopt_t) noexcept |
| ctor_empty | |
| SOL_TL_OPTIONAL_11_CONSTEXPR | optional (const optional &rhs) noexcept=default |
| SOL_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) |
| template<class U > | |
| constexpr | optional (const optional< U > &rhs) |
| ~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) |
| template<class U > | |
| optional & | operator= (const optional< U > &rhs) |
| template<class... Args> | |
| T & | emplace (Args &&... args) noexcept |
| void | swap (optional &rhs) noexcept |
| constexpr const T * | operator-> () const |
| SOL_TL_OPTIONAL_11_CONSTEXPR T * | operator-> () |
| SOL_TL_OPTIONAL_11_CONSTEXPR T & | operator* () |
| constexpr const T & | operator* () const |
| constexpr bool | has_value () const noexcept |
| constexpr | operator bool () const noexcept |
| has_value | |
| SOL_TL_OPTIONAL_11_CONSTEXPR T & | value () |
| SOL_TL_OPTIONAL_11_CONSTEXPR const T & | value () const |
| template<class U > | |
| constexpr T & | value_or (U &&u) const |
| void | reset () noexcept |
| Destroys the stored value if one exists, making the optional empty. | |
Public Attributes | |
| template<class F > | |
| decltype(detail::optional_map_impl(std::declval< optional & >(), std::declval< F && >())) SOL_TL_OPTIONAL_11_CONSTEXPR | map (F &&f) & |
| Carries out some operation on the stored object if there is one. More... | |
| template<class F > | |
| decltype(detail::optional_map_impl(std::declval< optional && >(), std::declval< F && >())) SOL_TL_OPTIONAL_11_CONSTEXPR | map (F &&f) && |
| template<class F > | |
| decltype(detail::optional_map_impl(std::declval< const optional & >(), std::declval< F && >())) constexpr | map (F &&f) const & |
| template<class F > | |
| decltype(detail::optional_map_impl(std::declval< const optional && >(), std::declval< F && >())) constexpr | map (F &&f) const && |
Specialization for when T is a reference. optional<T&> acts similarly to a T*, but provides more operations and shows intent more clearly.
Examples:
Assignment has rebind semantics rather than assign-through semantics:
|
inlinenoexcept |
Constructs an optional that does not contain a value. ctor_empty
|
defaultnoexcept |
Copy constructor
If rhs contains a value, the stored value is direct-initialized with it. Otherwise, the constructed optional is empty.
|
default |
Move constructor
If rhs contains a value, the stored value is direct-initialized with it. Otherwise, the constructed optional is empty.
|
inline |
Constructs the stored value with u. template <class u="T"> constexpr optional(U &&u);
|
inline |
and_then Carries out some operation which returns an optional on the stored object if there is one. std::invoke(std::forward<F>(f), value()) returns a std::optional<U> for some U.
|
inline |
and_then template <class f>="">
constexpr auto and_then(F &&f) &&;
|
inline |
and_then template <class f>="">
constexpr auto and_then(F &&f) const &;
|
inline |
and_then template <class f>="">
constexpr auto and_then(F &&f) const &&;
|
inline |
u if *this has a value, otherwise an empty optional.
|
inline |
rhs if *this is empty, otherwise the current value. disjunction
|
inlinenoexcept |
Constructs the value in-place, destroying the current one if there is one.
emplace
|
inlinenoexcept |
|
inline |
Maps the stored value with f if there is one, otherwise returns u.
If there is a value stored, then f is called with **this and the value is returned. Otherwise u is returned.
map_or
|
inline |
Maps the stored value with f if there is one, otherwise calls u and returns the result.
If there is a value stored, then f is called with **this and the value is returned. Otherwise std::forward<U>(u)() is returned.
map_or_else template <class F, class U>
auto map_or_else(F &&f, U &&u) &;
|
inline |
map_or_else template <class F, class U>
auto map_or_else(F &&f, U &&u) &&;
|
inline |
map_or_else template <class F, class U>
auto map_or_else(F &&f, U &&u) const &;
|
inline |
map_or_else template <class F, class U>
auto map_or_else(F &&f, U &&u) const &&;
|
inline |
|
inline |
deref constexpr const T &operator*() const;
|
inline |
|
inline |
pointer constexpr T *operator->();
|
inlinenoexcept |
Assignment to empty.
Destroys the current value if there is one.
|
default |
Copy assignment.
Rebinds this optional to the referee of rhs if there is one. Otherwise resets the stored value in *this.
|
inline |
Rebinds this optional to u.
U must be an lvalue reference. optional &operator=(U &&u);
|
inline |
Converting copy assignment operator.
Rebinds this optional to the referee of rhs if there is one. Otherwise resets the stored value in *this.
|
inline |
Calls f if the optional is empty std::invoke_result_t<F> must be void or convertible to optional<T>. If *this has a value, returns *this. Otherwise, if f returns void, calls std::forward<F>(f) and returns std::nullopt. Otherwise, returns std::forward<F>(f)().
or_else template <class f>=""> optional<T> or_else (F &&f) &;
|
inline |
or_else template <class f>=""> optional<T> or_else (F &&f) &&;
|
inline |
or_else template <class f>=""> optional<T> or_else (F &&f) const &;
|
inlinenoexcept |
Swaps this optional with the other.
If neither optionals have a value, nothing happens. If both have a value, the values are swapped. If one has a value, it is moved to the other and the movee is left valueless.
|
inline |
Takes the value out of the optional, leaving it empty take
|
inline |
|
inline |
value constexpr const T &value() const;
|
inline |
u value_or
|
inline |
Carries out some operation on the stored object if there is one.
U be the result of std::invoke(std::forward<F>(f), value()). Returns a std::optional<U>. The return value is empty if *this is empty, otherwise an optional<U> is constructed from the return value of std::invoke(std::forward<F>(f), value()) and is returned.map template <class f>=""> auto map(F &&f) &;
|
inline |
map template <class f>=""> auto map(F &&f) &&;
|
inline |
map template <class f>=""> auto map(F &&f) const&;
|
inline |
map template <class f>=""> auto map(F &&f) const&&;
1.8.13