= Reference :mrdocs: == Namespaces [cols=1] |=== | Name | link:#beman[`beman`] |=== == link:#beman[beman] namespace === Namespaces [cols=1] |=== | Name | link:#beman-optional[`optional`] |=== == link:#beman-optional[beman::optional] namespace === Types [cols=2] |=== | Name | Description | link:#beman-optional-bad_optional_access[`bad_optional_access`] | Exception thrown when trying to access the value of an empty optional | link:#beman-optional-hash-056[`hash`] | | link:#beman-optional-hash-051[`hash<optional<T>>`] | | link:#beman-optional-in_place_t[`in_place_t`] | Tag type for in place construction | link:#beman-optional-nullopt_t[`nullopt_t`] | Tag type for nullopt construction | link:#beman-optional-optional-03[`optional`] | | link:#beman-optional-optional-06[`optional<T&>`] | |=== === Functions [cols=2] |=== | Name | Description | link:#beman-optional-make_optional-02[`make_optional`] | | link:#beman-optional-swap[`swap`] | | link:#beman-optional-operator_eq-0b0[`operator==`] | Equality operators | link:#beman-optional-operator_not_eq-0c[`operator!=`] | Inequality operators | link:#beman-optional-operator_lt-07[`operator<`] | Less‐than operators | link:#beman-optional-operator_le-05[`operator<=`] | Less‐than‐or‐equal operators | link:#beman-optional-operator_gt-05[`operator>`] | Greater‐than operators | link:#beman-optional-operator_ge-09[`operator>=`] | Greater‐than‐or‐equal operators | link:#beman-optional-operator_3way-0b[`operator<=>`] | Three‐way comparison operators |=== === Variables [cols=2] |=== | Name | Description | link:#beman-optional-in_place[`in_place`] | | link:#beman-optional-nullopt[`nullopt`] | Tag to disengage optional objects. |=== === Concepts [cols=1] |=== | Name | link:#beman-optional-is_derived_from_optional[`is_derived_from_optional`] |=== == Namespaces [cols=1] |=== | Name | link:#beman-optional[`optional`] |=== == Types [cols=2] |=== | Name | Description | link:#beman-optional-bad_optional_access[`bad_optional_access`] | Exception thrown when trying to access the value of an empty optional | link:#beman-optional-hash-056[`hash`] | | link:#beman-optional-hash-051[`hash<optional<T>>`] | | link:#beman-optional-in_place_t[`in_place_t`] | Tag type for in place construction | link:#beman-optional-nullopt_t[`nullopt_t`] | Tag type for nullopt construction | link:#beman-optional-optional-03[`optional`] | | link:#beman-optional-optional-06[`optional<T&>`] | |=== == Functions [cols=2] |=== | Name | Description | link:#beman-optional-make_optional-02[`make_optional`] | | link:#beman-optional-swap[`swap`] | | link:#beman-optional-operator_eq-0b0[`operator==`] | Equality operators | link:#beman-optional-operator_not_eq-0c[`operator!=`] | Inequality operators | link:#beman-optional-operator_lt-07[`operator<`] | Less‐than operators | link:#beman-optional-operator_le-05[`operator<=`] | Less‐than‐or‐equal operators | link:#beman-optional-operator_gt-05[`operator>`] | Greater‐than operators | link:#beman-optional-operator_ge-09[`operator>=`] | Greater‐than‐or‐equal operators | link:#beman-optional-operator_3way-0b[`operator<=>`] | Three‐way comparison operators |=== == Variables [cols=2] |=== | Name | Description | link:#beman-optional-in_place[`in_place`] | | link:#beman-optional-nullopt[`nullopt`] | Tag to disengage optional objects. |=== == Concepts [cols=1] |=== | Name | link:#beman-optional-is_derived_from_optional[`is_derived_from_optional`] |=== Exception thrown when trying to access the value of an empty optional == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class bad_optional_access : public std::exception ---- == Base Classes [cols=2] |=== | Name | Description | `std::exception` | |=== == Member Functions [cols=2] |=== | Name | Description | link:#beman-optional-bad_optional_access-2constructor[`bad_optional_access`] [.small]#[constructor]# | Construct a new bad optional access object | link:#beman-optional-bad_optional_access-operator_assign[`operator=`] | | link:#beman-optional-bad_optional_access-what[`what`] [.small]#[virtual]# | Get the error message for bad optional access |=== Construct a new bad optional access object == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bad_optional_access() = default; ---- == Synopsis Declared in `<__exception/exception.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[__visibility__, __exclude_from_explicit_instantiation__, __abi_tag__]] constexpr exception& operator=(exception const& value) noexcept = default; ---- Get the error message for bad optional access == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- virtual char const* what() const noexcept; ---- == Return Value const char* == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> struct hash; ---- == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> struct link:#beman-optional-hash-056[hash]<link:#beman-optional-optional-03[optional<T>]>; ---- Tag type for in place construction == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct in_place_t; ---- == Member Functions [cols=2] |=== | Name | Description | link:#beman-optional-in_place_t-2constructor[`in_place_t`] [.small]#[constructor]# | Default constructor |=== Default constructor == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr explicit in_place_t() = default; ---- Tag type for nullopt construction == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct nullopt_t; ---- == Enums [cols=2] |=== | Name | Description | link:#beman-optional-nullopt_t-Tag[`Tag`] | Tag type for nullopt_t construction |=== == Member Functions [cols=2] |=== | Name | Description | link:#beman-optional-nullopt_t-2constructor[`nullopt_t`] [.small]#[constructor]# | Construct a new nullopt_t object |=== Tag type for nullopt_t construction == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- enum class Tag : int; ---- == Members [cols=2] |=== | Name | Description |`tag` | |=== Construct a new nullopt_t object == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr explicit nullopt_t(link:#beman-optional-nullopt_t-Tag[Tag] value) noexcept; ---- == Description constexpr for nullopt_t to be literal. == Parameters [cols=2] |=== | Name | Description | *value* | The object to construct from |=== == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> class optional; ---- == Types [cols=2] |=== | Name | Description | link:#beman-optional-optional-03-const_iterator[`const_iterator`] | Type alias for the const iterator type of the optional. | link:#beman-optional-optional-03-iterator[`iterator`] | Type alias for the iterator type of the optional. | link:#beman-optional-optional-03-value_type[`value_type`] | Type alias for the value type stored in the optional. |=== == Member Functions [cols=2] |=== | Name | Description | link:#beman-optional-optional-03-2constructor-026[`optional`] [.small]#[constructor]# | Constructors | link:#beman-optional-optional-03-2destructor-01[`~optional`] [.small]#[destructor]# | Destructors | link:#beman-optional-optional-03-operator_assign-01[`operator=`] | Assignment operators | link:#beman-optional-optional-03-and_then-02[`and_then`] | Returns an optional containing the result of applying `f` to the stored value. | link:#beman-optional-optional-03-begin-09[`begin`] | `begin` overloads | link:#beman-optional-optional-03-emplace-07[`emplace`] | `emplace` overloads | link:#beman-optional-optional-03-end-01[`end`] | `end` overloads | link:#beman-optional-optional-03-has_value[`has_value`] | Returns whether or not the optional has a value. | link:#beman-optional-optional-03-operator_star-03[`operator*`] | Returns a reference to the stored value. | link:#beman-optional-optional-03-operator_ptr-094[`operator‐>`] | Returns a pointer to the stored value. | link:#beman-optional-optional-03-or_else-01[`or_else`] | Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not. | link:#beman-optional-optional-03-reset[`reset`] | Resets the optional to an empty state, destroying the stored value if there is one. | link:#beman-optional-optional-03-swap[`swap`] | Swaps this optional with the other. | link:#beman-optional-optional-03-transform-08[`transform`] | Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. | link:#beman-optional-optional-03-value-028[`value`] | Returns a reference to the stored value. | link:#beman-optional-optional-03-value_or-03[`value_or`] | Returns a reference to the stored value. | link:#beman-optional-optional-03-2conversion[`operator bool`] | Converts the optional to a boolean indicating whether it has a value. |=== == Data Members [cols=2] |=== | Name | Description | link:#beman-optional-optional-03-_[`_`] [.small]#[variant member]# | The empty state of the optional. | link:#beman-optional-optional-03-value_[`value_`] [.small]#[variant member]# | The stored value of the optional. |=== == Friends [cols=2] |=== | Name | Description | `link:#beman-optional-optional-03[beman::optional::optional]` | |=== == Template Parameters [cols=2] |=== | Name | Description | *T* | |=== Type alias for the const iterator type of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using const_iterator = /* implementation-defined */::contiguous_iterator<T const, optional>; ---- == Description Since P3168R2: Give std::optional Range Support. Type alias for the iterator type of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using iterator = /* implementation-defined */::contiguous_iterator<T, optional>; ---- == Description Since P3168R2: Give std::optional Range Support. Type alias for the value type stored in the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = T; ---- Constructors == Synopses Declared in `<beman/optional/optional.hpp>` Default constructs an empty optional. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-2constructor-066[optional]() noexcept; ---- [.small]#link:#beman-optional-optional-03-2constructor-066[_» more..._]# Copy constructs the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-2constructor-06c[optional](link:#beman-optional-optional-03[optional] const& other) requires std::is_copy_constructible_v<T> && std::is_trivially_copy_constructible_v<T> = default; ---- [.small]#link:#beman-optional-optional-03-2constructor-06c[_» more..._]# Copy constructs the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-2constructor-0c[optional](link:#beman-optional-optional-03[optional] const& rhs) requires std::is_copy_constructible_v<T> && (!std::is_trivially_copy_constructible_v<T>); ---- [.small]#link:#beman-optional-optional-03-2constructor-0c[_» more..._]# Constructs the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> constexpr explicit(!std::is_convertible_v<U, T>) link:#beman-optional-optional-03-2constructor-04a[optional](link:#beman-optional-optional-03[optional<U>] const& rhs) requires (detail::enable_from_other<T, U, const U&>); ---- [.small]#link:#beman-optional-optional-03-2constructor-04a[_» more..._]# Move constructs the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-2constructor-05[optional](link:#beman-optional-optional-03[optional]&& other) requires std::is_move_constructible_v<T> && std::is_trivially_move_constructible_v<T> = default; ---- [.small]#link:#beman-optional-optional-03-2constructor-05[_» more..._]# Move constructs the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-2constructor-0b[optional](link:#beman-optional-optional-03[optional]&& rhs) noexcept(std::is_nothrow_move_constructible_v<T>) requires std::is_move_constructible_v<T> && (!std::is_trivially_move_constructible_v<T>); ---- [.small]#link:#beman-optional-optional-03-2constructor-0b[_» more..._]# Constructs the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> constexpr explicit(!std::is_convertible_v<U, T>) link:#beman-optional-optional-03-2constructor-06e[optional](link:#beman-optional-optional-03[optional<U>]&& rhs) requires (detail::enable_from_other<T, U, U &&>); ---- [.small]#link:#beman-optional-optional-03-2constructor-06e[_» more..._]# Constructs an empty optional. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-2constructor-043[optional](link:#beman-optional-nullopt_t[nullopt_t] value) noexcept; ---- [.small]#link:#beman-optional-optional-03-2constructor-043[_» more..._]# Constructs the value from `u,` forwarding it if necessary. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = T> constexpr explicit(!std::is_convertible_v<U, T>) link:#beman-optional-optional-03-2constructor-00[optional](U&& u) requires detail::enable_forward_value<T, U>; ---- [.small]#link:#beman-optional-optional-03-2constructor-00[_» more..._]# Constructs the value in‐place using the given arguments. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> constexpr explicit link:#beman-optional-optional-03-2constructor-02a[optional]( link:#beman-optional-in_place_t[in_place_t], Args...&&... args) requires std::is_constructible_v<T, Args...>; ---- [.small]#link:#beman-optional-optional-03-2constructor-02a[_» more..._]# Constructs the value in‐place using the given arguments. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class U, class... Args> constexpr explicit link:#beman-optional-optional-03-2constructor-07[optional]( link:#beman-optional-in_place_t[in_place_t], std::initializer_list<U> il, Args...&&... args) requires std::is_constructible_v<T, std::initializer_list<U>&, Args&&...>; ---- [.small]#link:#beman-optional-optional-03-2constructor-07[_» more..._]# == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== Default constructs an empty optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional() noexcept; ---- Copy constructs the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional(link:#beman-optional-optional-03[optional] const& other) requires std::is_copy_constructible_v<T> && std::is_trivially_copy_constructible_v<T> = default; ---- == Description Defaulted if T is trivially copy constructible. == Parameters [cols=2] |=== | Name | Description | *other* | The object to copy construct from |=== Copy constructs the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional(link:#beman-optional-optional-03[optional] const& rhs) requires std::is_copy_constructible_v<T> && (!std::is_trivially_copy_constructible_v<T>); ---- == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to copy construct from |=== Constructs the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> constexpr explicit(!std::is_convertible_v<U, T>) optional(link:#beman-optional-optional-03[optional<U>] const& rhs) requires (detail::enable_from_other<T, U, const U&>); ---- == Description Converting copy constructor. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to copy construct from |=== Move constructs the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional(link:#beman-optional-optional-03[optional]&& other) requires std::is_move_constructible_v<T> && std::is_trivially_move_constructible_v<T> = default; ---- == Description Defaulted if T is trivially move constructible. == Parameters [cols=2] |=== | Name | Description | *other* | The object to move construct from |=== Move constructs the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional(link:#beman-optional-optional-03[optional]&& rhs) noexcept(std::is_nothrow_move_constructible_v<T>) requires std::is_move_constructible_v<T> && (!std::is_trivially_move_constructible_v<T>); ---- == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to move construct from |=== Constructs the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> constexpr explicit(!std::is_convertible_v<U, T>) optional(link:#beman-optional-optional-03[optional<U>]&& rhs) requires (detail::enable_from_other<T, U, U &&>); ---- == Description Converting move constructor. == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to move construct from |=== Constructs an empty optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional(link:#beman-optional-nullopt_t[nullopt_t] value) noexcept; ---- == Parameters [cols=2] |=== | Name | Description | *value* | The object to construct from |=== Constructs the value from `u,` forwarding it if necessary. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = T> constexpr explicit(!std::is_convertible_v<U, T>) optional(U&& u) requires detail::enable_forward_value<T, U>; ---- == Description If `u` is convertible to `T,` this is an explicit constructor. Constructs the stored value with `u`. == Parameters [cols=2] |=== | Name | Description | *u* | The object to move construct from |=== Constructs the value in‐place using the given arguments. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> constexpr explicit optional( link:#beman-optional-in_place_t[in_place_t], Args...&&... args) requires std::is_constructible_v<T, Args...>; ---- == Description Constructs the stored value in‐place using the given arguments. Constructs the value in‐place using the given arguments. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class U, class... Args> constexpr explicit optional( link:#beman-optional-in_place_t[in_place_t], std::initializer_list<U> il, Args...&&... args) requires std::is_constructible_v<T, std::initializer_list<U>&, Args&&...>; ---- Destructors == Synopses Declared in `<beman/optional/optional.hpp>` Destructs the optional. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-2destructor-0b[~optional]() requires std::is_trivially_destructible_v<T> = default; ---- [.small]#link:#beman-optional-optional-03-2destructor-0b[_» more..._]# Destroys the optional and its value if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-2destructor-0e[~optional]() requires (!std::is_trivially_destructible_v<T>); ---- [.small]#link:#beman-optional-optional-03-2destructor-0e[_» more..._]# Destructs the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ~optional() requires std::is_trivially_destructible_v<T> = default; ---- Destroys the optional and its value if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ~optional() requires (!std::is_trivially_destructible_v<T>); ---- Assignment operators == Synopses Declared in `<beman/optional/optional.hpp>` Copy assigns the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional]& link:#beman-optional-optional-03-operator_assign-06[operator=](link:#beman-optional-optional-03[optional] const& other) requires std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T> && std::is_trivially_copy_constructible_v<T> && std::is_trivially_copy_assignable_v<T> = default; ---- [.small]#link:#beman-optional-optional-03-operator_assign-06[_» more..._]# Copy assigns the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional<T>]& link:#beman-optional-optional-03-operator_assign-09[operator=](link:#beman-optional-optional-03[optional] const& rhs) requires std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T> && (!std::is_trivially_copy_assignable_v<T>); ---- [.small]#link:#beman-optional-optional-03-operator_assign-09[_» more..._]# Assigns the stored value from `rhs` if it has one, destroying the old value if there [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> constexpr link:#beman-optional-optional-03[optional<T>]& link:#beman-optional-optional-03-operator_assign-08[operator=](link:#beman-optional-optional-03[optional<U>] const& rhs) requires (detail::enable_assign_from_other<T, U, const U&>); ---- [.small]#link:#beman-optional-optional-03-operator_assign-08[_» more..._]# Move assigns the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional]& link:#beman-optional-optional-03-operator_assign-0d[operator=](link:#beman-optional-optional-03[optional]&& other) requires std::is_move_constructible_v<T> && std::is_move_assignable_v<T> && std::is_trivially_move_constructible_v<T> && std::is_trivially_move_assignable_v<T> = default; ---- [.small]#link:#beman-optional-optional-03-operator_assign-0d[_» more..._]# Move assigns the value from `rhs` if it has one. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional<T>]& link:#beman-optional-optional-03-operator_assign-0b8[operator=](link:#beman-optional-optional-03[optional]&& rhs) noexcept(std::is_nothrow_move_constructible_v<T>) requires std::is_move_constructible_v<T> && std::is_move_assignable_v<T> && (!std::is_trivially_move_assignable_v<T>); ---- [.small]#link:#beman-optional-optional-03-operator_assign-0b8[_» more..._]# Assigns the stored value from `rhs` if it has one, destroying the old value if there [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> constexpr link:#beman-optional-optional-03[optional<T>]& link:#beman-optional-optional-03-operator_assign-07[operator=](link:#beman-optional-optional-03[optional<U>]&& rhs) requires (detail::enable_assign_from_other<T, U, U>); ---- [.small]#link:#beman-optional-optional-03-operator_assign-07[_» more..._]# Resets the optional to an empty state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional<T>]& link:#beman-optional-optional-03-operator_assign-0f[operator=](link:#beman-optional-nullopt_t[nullopt_t] value) noexcept; ---- [.small]#link:#beman-optional-optional-03-operator_assign-0f[_» more..._]# Assigns the stored value from `u,` destroying the old value if there [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = T> constexpr link:#beman-optional-optional-03[optional<T>]& link:#beman-optional-optional-03-operator_assign-0b6[operator=](U&& u) requires detail::enable_assign_forward<T, U>; ---- [.small]#link:#beman-optional-optional-03-operator_assign-0b6[_» more..._]# == Return Value optional& == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | |=== Copy assigns the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional]& operator=(link:#beman-optional-optional-03[optional] const& other) requires std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T> && std::is_trivially_copy_constructible_v<T> && std::is_trivially_copy_assignable_v<T> = default; ---- == Return Value optional& == Parameters [cols=2] |=== | Name | Description | *other* | The object to copy assign from |=== Copy assigns the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional<T>]& operator=(link:#beman-optional-optional-03[optional] const& rhs) requires std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T> && (!std::is_trivially_copy_assignable_v<T>); ---- == Return Value Reference to the current object == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to copy assign from |=== Assigns the stored value from `rhs` if it has one, destroying the old value if there == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> constexpr link:#beman-optional-optional-03[optional<T>]& operator=(link:#beman-optional-optional-03[optional<U>] const& rhs) requires (detail::enable_assign_from_other<T, U, const U&>); ---- == Description Converting copy assignment operator. Copies the value from `rhs` if there is one. Otherwise resets the stored value in `*this`. == Return Value Reference to the current object == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to copy assign from |=== Move assigns the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional]& operator=(link:#beman-optional-optional-03[optional]&& other) requires std::is_move_constructible_v<T> && std::is_move_assignable_v<T> && std::is_trivially_move_constructible_v<T> && std::is_trivially_move_assignable_v<T> = default; ---- == Return Value Reference to the current object == Parameters [cols=2] |=== | Name | Description | *other* | The object to move assign from |=== Move assigns the value from `rhs` if it has one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional<T>]& operator=(link:#beman-optional-optional-03[optional]&& rhs) noexcept(std::is_nothrow_move_constructible_v<T>) requires std::is_move_constructible_v<T> && std::is_move_assignable_v<T> && (!std::is_trivially_move_assignable_v<T>); ---- == Return Value Reference to the current object == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to move assign from |=== Assigns the stored value from `rhs` if it has one, destroying the old value if there == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> constexpr link:#beman-optional-optional-03[optional<T>]& operator=(link:#beman-optional-optional-03[optional<U>]&& rhs) requires (detail::enable_assign_from_other<T, U, U>); ---- == Description Converting move assignment operator. Moves the value from `rhs` if there is one. Otherwise resets the stored value in `*this`. == Return Value Reference to the current object == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to move assign from |=== Resets the optional to an empty state. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03[optional<T>]& operator=(link:#beman-optional-nullopt_t[nullopt_t] value) noexcept; ---- == Return Value Reference to the current object == Parameters [cols=2] |=== | Name | Description | *value* | The object to assign from |=== Assigns the stored value from `u,` destroying the old value if there == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = T> constexpr link:#beman-optional-optional-03[optional<T>]& operator=(U&& u) requires detail::enable_assign_forward<T, U>; ---- == Description Assigns the stored value from `u`, destroying the old value if there was one. == Return Value optional& == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | |=== Returns an optional containing the result of applying `f` to the stored value. == Synopses Declared in `<beman/optional/optional.hpp>` Returns an optional containing the result of applying `f` to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto link:#beman-optional-optional-03-and_then-08[and_then](F&& f) const &&; ---- [.small]#link:#beman-optional-optional-03-and_then-08[_» more..._]# Returns an optional containing the result of applying `f` to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto link:#beman-optional-optional-03-and_then-0c[and_then](F&& f) const &; ---- [.small]#link:#beman-optional-optional-03-and_then-0c[_» more..._]# Returns an optional containing the result of applying `f` to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto link:#beman-optional-optional-03-and_then-0d[and_then](F&& f) &&; ---- [.small]#link:#beman-optional-optional-03-and_then-0d[_» more..._]# Returns an optional containing the result of applying `f` to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto link:#beman-optional-optional-03-and_then-03[and_then](F&& f) &; ---- [.small]#link:#beman-optional-optional-03-and_then-03[_» more..._]# == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the result of applying `f` to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto and_then(F&& f) const &&; ---- == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the result of applying `f` to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto and_then(F&& f) const &; ---- == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the result of applying `f` to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto and_then(F&& f) &&; ---- == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the result of applying `f` to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto and_then(F&& f) &; ---- == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== `begin` overloads == Synopses Declared in `<beman/optional/optional.hpp>` Returns an iterator to the beginning of the optional. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-iterator[optional<T>::iterator] link:#beman-optional-optional-03-begin-0a[begin]() noexcept; ---- [.small]#link:#beman-optional-optional-03-begin-0a[_» more..._]# Returns a const iterator to the beginning of the optional. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-const_iterator[optional<T>::const_iterator] link:#beman-optional-optional-03-begin-00[begin]() const noexcept; ---- [.small]#link:#beman-optional-optional-03-begin-00[_» more..._]# == Return Value const_iterator Returns an iterator to the beginning of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-iterator[optional<T>::iterator] begin() noexcept; ---- == Return Value an iterator to the beginning of the optional. Returns a const iterator to the beginning of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-const_iterator[optional<T>::const_iterator] begin() const noexcept; ---- == Return Value const_iterator `emplace` overloads == Synopses Declared in `<beman/optional/optional.hpp>` Constructs the value in‐place, destroying the current one if there [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> constexpr T& link:#beman-optional-optional-03-emplace-04[emplace](Args...&&... args); ---- [.small]#link:#beman-optional-optional-03-emplace-04[_» more..._]# Constructs the value in‐place using the given arguments, destroying the current one if there [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class U, class... Args> constexpr T& link:#beman-optional-optional-03-emplace-08[emplace]( std::initializer_list<U> il, Args...&&... args); ---- [.small]#link:#beman-optional-optional-03-emplace-08[_» more..._]# == Return Value T& == Template Parameters [cols=2] |=== | Name | Description | *Args* | | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *args* | | *il* | |=== Constructs the value in‐place, destroying the current one if there == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> constexpr T& emplace(Args...&&... args); ---- == Description Constructs the value in‐place, destroying the current one if there is one. == Return Value T& == Template Parameters [cols=2] |=== | Name | Description | *Args* | |=== == Parameters [cols=2] |=== | Name | Description | *args* | |=== Constructs the value in‐place using the given arguments, destroying the current one if there == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class U, class... Args> constexpr T& emplace( std::initializer_list<U> il, Args...&&... args); ---- == Return Value T& == Template Parameters [cols=2] |=== | Name | Description | *U* | | *Args* | |=== == Parameters [cols=2] |=== | Name | Description | *il* | | *args* | |=== `end` overloads == Synopses Declared in `<beman/optional/optional.hpp>` Returns an iterator to the end of the optional. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-iterator[optional<T>::iterator] link:#beman-optional-optional-03-end-05[end]() noexcept; ---- [.small]#link:#beman-optional-optional-03-end-05[_» more..._]# Returns a const iterator to the end of the optional. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-const_iterator[optional<T>::const_iterator] link:#beman-optional-optional-03-end-02[end]() const noexcept; ---- [.small]#link:#beman-optional-optional-03-end-02[_» more..._]# == Return Value const_iterator Returns an iterator to the end of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-iterator[optional<T>::iterator] end() noexcept; ---- == Return Value an iterator to the end of the optional. Returns a const iterator to the end of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-03-const_iterator[optional<T>::const_iterator] end() const noexcept; ---- == Return Value const_iterator Returns whether or not the optional has a value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool has_value() const noexcept; ---- == Description Returns whether or not the optional has a value == Return Value bool Returns a reference to the stored value. == Synopses Declared in `<beman/optional/optional.hpp>` Returns a reference to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T& link:#beman-optional-optional-03-operator_star-092[operator*]() &; ---- [.small]#link:#beman-optional-optional-03-operator_star-092[_» more..._]# Returns a reference to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T const& link:#beman-optional-optional-03-operator_star-06[operator*]() const &; ---- [.small]#link:#beman-optional-optional-03-operator_star-06[_» more..._]# Returns a reference to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T&& link:#beman-optional-optional-03-operator_star-091[operator*]() &&; ---- [.small]#link:#beman-optional-optional-03-operator_star-091[_» more..._]# == Return Value * T& * const T& * T&& Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T& operator*() &; ---- == Description Returns the stored value == Return Value T& Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T const& operator*() const &; ---- == Return Value const T& Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T&& operator*() &&; ---- == Return Value T&& Returns a pointer to the stored value. == Synopses Declared in `<beman/optional/optional.hpp>` Returns a pointer to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T const* link:#beman-optional-optional-03-operator_ptr-093[operator‐>]() const; ---- [.small]#link:#beman-optional-optional-03-operator_ptr-093[_» more..._]# Returns a pointer to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T* link:#beman-optional-optional-03-operator_ptr-06[operator‐>](); ---- [.small]#link:#beman-optional-optional-03-operator_ptr-06[_» more..._]# == Return Value T* Returns a pointer to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T const* operator‐>() const; ---- == Description Returns a pointer to the stored value == Return Value a pointer to the stored value. Returns a pointer to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T* operator‐>(); ---- == Return Value T* Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not. == Synopses Declared in `<beman/optional/optional.hpp>` Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr link:#beman-optional-optional-03[optional<T>] link:#beman-optional-optional-03-or_else-04[or_else](F&& f) &&; ---- [.small]#link:#beman-optional-optional-03-or_else-04[_» more..._]# Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr link:#beman-optional-optional-03[optional<T>] link:#beman-optional-optional-03-or_else-05[or_else](F&& f) const &; ---- [.small]#link:#beman-optional-optional-03-or_else-05[_» more..._]# == Return Value * auto * optional<T> * optional == Template Parameters [cols=2] |=== | Name | Description | *F* | | *T* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr link:#beman-optional-optional-03[optional<T>] or_else(F&& f) &&; ---- == Return Value * auto * optional<T> == Template Parameters [cols=2] |=== | Name | Description | *F* | | *T* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr link:#beman-optional-optional-03[optional<T>] or_else(F&& f) const &; ---- == Return Value * optional * optional<T> == Template Parameters [cols=2] |=== | Name | Description | *F* | | *T* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Resets the optional to an empty state, destroying the stored value if there is one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr void reset() noexcept; ---- Swaps this optional with the other. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr void swap(link:#beman-optional-optional-03[optional]& rhs) noexcept(std::is_nothrow_move_constructible<T>::value && std::is_nothrow_swappable<T>::value); ---- == Description 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. == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. == Synopses Declared in `<beman/optional/optional.hpp>` Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto link:#beman-optional-optional-03-transform-070[transform](F&& f) const &&; ---- [.small]#link:#beman-optional-optional-03-transform-070[_» more..._]# Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto link:#beman-optional-optional-03-transform-01[transform](F&& f) const &; ---- [.small]#link:#beman-optional-optional-03-transform-01[_» more..._]# Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto link:#beman-optional-optional-03-transform-0d[transform](F&& f) &&; ---- [.small]#link:#beman-optional-optional-03-transform-0d[_» more..._]# Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto link:#beman-optional-optional-03-transform-07a[transform](F&& f) &; ---- [.small]#link:#beman-optional-optional-03-transform-07a[_» more..._]# == Return Value * auto * optional == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto transform(F&& f) const &&; ---- == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto transform(F&& f) const &; ---- == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto transform(F&& f) &&; ---- == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto transform(F&& f) &; ---- == Description Carries out some operation on the stored object if there is one. == Return Value optional == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns a reference to the stored value. == Synopses Declared in `<beman/optional/optional.hpp>` Returns a reference to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T& link:#beman-optional-optional-03-value-0d[value]() &; ---- [.small]#link:#beman-optional-optional-03-value-0d[_» more..._]# Returns a reference to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T const& link:#beman-optional-optional-03-value-09[value]() const &; ---- [.small]#link:#beman-optional-optional-03-value-09[_» more..._]# Returns a reference to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T&& link:#beman-optional-optional-03-value-02a[value]() &&; ---- [.small]#link:#beman-optional-optional-03-value-02a[_» more..._]# == Return Value * T& * const T& * T&& Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T& value() &; ---- == Description Returns the contained value if there is one, otherwise throws bad_optional_access == Return Value T& Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T const& value() const &; ---- == Return Value const T& Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T&& value() &&; ---- == Return Value T&& Returns a reference to the stored value. == Synopses Declared in `<beman/optional/optional.hpp>` Returns a reference to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = std::remove_cv_t<T>> constexpr T link:#beman-optional-optional-03-value_or-0b5[value_or](U&& u) const &; ---- [.small]#link:#beman-optional-optional-03-value_or-0b5[_» more..._]# Returns a reference to the stored value. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = std::remove_cv_t<T>> constexpr T link:#beman-optional-optional-03-value_or-0b1[value_or](U&& u) &&; ---- [.small]#link:#beman-optional-optional-03-value_or-0b1[_» more..._]# == Return Value T == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | |=== Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = std::remove_cv_t<T>> constexpr T value_or(U&& u) const &; ---- == Description Returns the stored value if there is one, otherwise returns `u` == Return Value T == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | |=== Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = std::remove_cv_t<T>> constexpr T value_or(U&& u) &&; ---- == Return Value T == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | |=== Converts the optional to a boolean indicating whether it has a value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr explicit operator bool() const noexcept; ---- == Return Value bool The empty state of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- link:#beman-optional-optional-03[empty] _ = {}; ---- The stored value of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- T value_; ---- == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> class link:#beman-optional-optional-03[optional]<T&>; ---- == Types [cols=2] |=== | Name | Description | link:#beman-optional-optional-06-iterator[`iterator`] | The type of the iterator for the optional. | link:#beman-optional-optional-06-value_type[`value_type`] | The type of the value stored in the optional. |=== == Member Functions [cols=2] |=== | Name | Description | link:#beman-optional-optional-06-2constructor-03[`optional`] [.small]#[constructor]# | Constructors | link:#beman-optional-optional-06-2destructor[`~optional`] [.small]#[destructor]# | Destructor. | link:#beman-optional-optional-06-operator_assign-0f[`operator=`] | Assignment operators | link:#beman-optional-optional-06-and_then[`and_then`] | Applies a function to the stored value if there is one. | link:#beman-optional-optional-06-begin[`begin`] | Returns an iterator to the beginning of the optional. | link:#beman-optional-optional-06-emplace[`emplace`] | Converting copy assignment operator. | link:#beman-optional-optional-06-end[`end`] | Returns an iterator to the end of the optional. | link:#beman-optional-optional-06-has_value[`has_value`] | Checks if the optional has a value. | link:#beman-optional-optional-06-operator_star[`operator*`] | Returns a reference to the stored value. | link:#beman-optional-optional-06-operator_ptr[`operator‐>`] | Returns a pointer to the stored value. | link:#beman-optional-optional-06-or_else[`or_else`] | Calls a function if the optional is empty. | link:#beman-optional-optional-06-reset[`reset`] | Resets the optional to an empty state. | link:#beman-optional-optional-06-swap[`swap`] | Swaps the contents of this optional with another. | link:#beman-optional-optional-06-transform[`transform`] | Applies a function to the stored value if there is one. | link:#beman-optional-optional-06-value[`value`] | Returns the stored value if there is one, otherwise throws | link:#beman-optional-optional-06-value_or[`value_or`] | Returns the stored value if there is one, otherwise returns `u`. | link:#beman-optional-optional-06-2conversion[`operator bool`] | Converts the optional to a boolean value. |=== == Friends [cols=2] |=== | Name | Description | `link:#beman-optional-optional-03[beman::optional::optional]` | |=== The type of the iterator for the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using iterator = /* implementation-defined */::contiguous_iterator<T, optional>; ---- The type of the value stored in the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- using value_type = T; ---- Constructors == Synopses Declared in `<beman/optional/optional.hpp>` Default constructor. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06-2constructor-070[optional]() noexcept = default; ---- [.small]#link:#beman-optional-optional-06-2constructor-070[_» more..._]# Copy constructor. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06-2constructor-0a3d[optional](link:#beman-optional-optional-06[optional] const& rhs) noexcept = default; ---- [.small]#link:#beman-optional-optional-06-2constructor-0a3d[_» more..._]# Constructs an empty optional. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06-2constructor-008[optional](link:#beman-optional-nullopt_t[nullopt_t] value) noexcept; ---- [.small]#link:#beman-optional-optional-06-2constructor-008[_» more..._]# Constructs an optional from another optional of type U [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U&> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && detail::reference_constructs_from_temporary_v<T&, U&>) constexpr link:#beman-optional-optional-06-2constructor-01d[optional](link:#beman-optional-optional-03[optional<U>]& rhs) = delete; ---- [.small]#link:#beman-optional-optional-06-2constructor-01d[_» more..._]# Constructs an optional from another optional of type U. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U&> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, U&>) constexpr explicit(!std::is_convertible_v<U &, T &>) link:#beman-optional-optional-06-2constructor-0fa[optional](link:#beman-optional-optional-03[optional<U>]& rhs) noexcept(std::is_nothrow_constructible_v<T &, U &>); ---- [.small]#link:#beman-optional-optional-06-2constructor-0fa[_» more..._]# Constructs an optional from another optional of type U [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U&> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && detail::reference_constructs_from_temporary_v<T&, const U&>) constexpr link:#beman-optional-optional-06-2constructor-07d[optional](link:#beman-optional-optional-03[optional<U>] const& rhs) = delete; ---- [.small]#link:#beman-optional-optional-06-2constructor-07d[_» more..._]# Constructs an optional from another optional of type U. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U&> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, const U&>) constexpr explicit(!std::is_convertible_v<const U &, T &>) link:#beman-optional-optional-06-2constructor-0a31[optional](link:#beman-optional-optional-03[optional<U>] const& rhs) noexcept(std::is_nothrow_constructible_v<T &, const U &>); ---- [.small]#link:#beman-optional-optional-06-2constructor-0a31[_» more..._]# Constructs an optional from a U, but deletes the constructor if [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !(std::is_same_v<std::remove_cvref_t<U>, in_place_t>) && !(std::is_same_v<std::remove_cvref_t<U>, optional>) && detail::reference_constructs_from_temporary_v<T&, U>) constexpr link:#beman-optional-optional-06-2constructor-004[optional](U&& u) = delete; ---- [.small]#link:#beman-optional-optional-06-2constructor-004[_» more..._]# Construct from a U [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !(std::is_same_v<std::remove_cvref_t<U>, in_place_t>) && !(std::is_same_v<std::remove_cvref_t<U>, optional>) && !detail::reference_constructs_from_temporary_v<T&, U>) constexpr explicit(!std::is_convertible_v<U, T &>) link:#beman-optional-optional-06-2constructor-01a[optional](U&& u) noexcept(std::is_nothrow_constructible_v<T &, U>); ---- [.small]#link:#beman-optional-optional-06-2constructor-01a[_» more..._]# Constructs an optional from another optional of type U [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && detail::reference_constructs_from_temporary_v<T&, U>) constexpr link:#beman-optional-optional-06-2constructor-0a36[optional](link:#beman-optional-optional-03[optional<U>]&& rhs) = delete; ---- [.small]#link:#beman-optional-optional-06-2constructor-0a36[_» more..._]# Constructs an optional from another optional of type U. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, U>) constexpr explicit(!std::is_convertible_v<U, T &>) link:#beman-optional-optional-06-2constructor-08[optional](link:#beman-optional-optional-03[optional<U>]&& rhs) noexcept(noexcept(std::is_nothrow_constructible_v<T &, U>)); ---- [.small]#link:#beman-optional-optional-06-2constructor-08[_» more..._]# Constructs an optional from another optional of type U [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && detail::reference_constructs_from_temporary_v<T&, const U>) constexpr link:#beman-optional-optional-06-2constructor-04[optional](link:#beman-optional-optional-03[optional<U>] const&& rhs) = delete; ---- [.small]#link:#beman-optional-optional-06-2constructor-04[_» more..._]# Constructs an optional from another optional of type U. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, const U>) constexpr explicit(!std::is_convertible_v<const U, T &>) link:#beman-optional-optional-06-2constructor-05[optional](link:#beman-optional-optional-03[optional<U>] const&& rhs) noexcept(noexcept(std::is_nothrow_constructible_v<T &, const U>)); ---- [.small]#link:#beman-optional-optional-06-2constructor-05[_» more..._]# In‐place constructor. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class Arg> requires (std::is_constructible_v<T&, Arg> && !detail::reference_constructs_from_temporary_v<T&, Arg>) constexpr explicit link:#beman-optional-optional-06-2constructor-0f8[optional]( link:#beman-optional-in_place_t[in_place_t], Arg&& arg); ---- [.small]#link:#beman-optional-optional-06-2constructor-0f8[_» more..._]# == Template Parameters [cols=2] |=== | Name | Description | *U* | | *Arg* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | | *u* | | *arg* | |=== Default constructor. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional() noexcept = default; ---- Copy constructor. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional(link:#beman-optional-optional-06[optional] const& rhs) noexcept = default; ---- == Description Constructs an empty optional if the rhs is empty, otherwise constructs the stored value from the rhs. == Parameters [cols=2] |=== | Name | Description | *rhs* | The object to copy construct from |=== Constructs an empty optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr optional(link:#beman-optional-nullopt_t[nullopt_t] value) noexcept; ---- == Parameters [cols=2] |=== | Name | Description | *value* | The object to construct from |=== Constructs an optional from another optional of type U == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U&> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && detail::reference_constructs_from_temporary_v<T&, U&>) constexpr optional(link:#beman-optional-optional-03[optional<U>]& rhs) = delete; ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Constructs an optional from another optional of type U. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U&> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, U&>) constexpr explicit(!std::is_convertible_v<U &, T &>) optional(link:#beman-optional-optional-03[optional<U>]& rhs) noexcept(std::is_nothrow_constructible_v<T &, U &>); ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Constructs an optional from another optional of type U == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U&> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && detail::reference_constructs_from_temporary_v<T&, const U&>) constexpr optional(link:#beman-optional-optional-03[optional<U>] const& rhs) = delete; ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Constructs an optional from another optional of type U. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U&> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, const U&>) constexpr explicit(!std::is_convertible_v<const U &, T &>) optional(link:#beman-optional-optional-03[optional<U>] const& rhs) noexcept(std::is_nothrow_constructible_v<T &, const U &>); ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Constructs an optional from a U, but deletes the constructor if == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !(std::is_same_v<std::remove_cvref_t<U>, in_place_t>) && !(std::is_same_v<std::remove_cvref_t<U>, optional>) && detail::reference_constructs_from_temporary_v<T&, U>) constexpr optional(U&& u) = delete; ---- == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | The object to move construct from |=== Construct from a U == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !(std::is_same_v<std::remove_cvref_t<U>, in_place_t>) && !(std::is_same_v<std::remove_cvref_t<U>, optional>) && !detail::reference_constructs_from_temporary_v<T&, U>) constexpr explicit(!std::is_convertible_v<U, T &>) optional(U&& u) noexcept(std::is_nothrow_constructible_v<T &, U>); ---- == Description Constructs the stored value from `u` if it is convertible to `T&`. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | |=== Constructs an optional from another optional of type U == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && detail::reference_constructs_from_temporary_v<T&, U>) constexpr optional(link:#beman-optional-optional-03[optional<U>]&& rhs) = delete; ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Constructs an optional from another optional of type U. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, U>) constexpr explicit(!std::is_convertible_v<U, T &>) optional(link:#beman-optional-optional-03[optional<U>]&& rhs) noexcept(noexcept(std::is_nothrow_constructible_v<T &, U>)); ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Constructs an optional from another optional of type U == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && detail::reference_constructs_from_temporary_v<T&, const U>) constexpr optional(link:#beman-optional-optional-03[optional<U>] const&& rhs) = delete; ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Constructs an optional from another optional of type U. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, const U>) constexpr explicit(!std::is_convertible_v<const U, T &>) optional(link:#beman-optional-optional-03[optional<U>] const&& rhs) noexcept(noexcept(std::is_nothrow_constructible_v<T &, const U>)); ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== In‐place constructor. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class Arg> requires (std::is_constructible_v<T&, Arg> && !detail::reference_constructs_from_temporary_v<T&, Arg>) constexpr explicit optional( link:#beman-optional-in_place_t[in_place_t], Arg&& arg); ---- == Template Parameters [cols=2] |=== | Name | Description | *Arg* | |=== == Parameters [cols=2] |=== | Name | Description | *arg* | |=== Destructor. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr ~optional() = default; ---- == Description Does not destroy the stored value, as it is a reference. Assignment operators == Synopses Declared in `<beman/optional/optional.hpp>` Copy assignment operator. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06[optional]& link:#beman-optional-optional-06-operator_assign-04[operator=](link:#beman-optional-optional-06[optional] const& rhs) noexcept = default; ---- [.small]#link:#beman-optional-optional-06-operator_assign-04[_» more..._]# Assignment operator. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06[optional<T&>]& link:#beman-optional-optional-06-operator_assign-0e[operator=](link:#beman-optional-nullopt_t[nullopt_t] value) noexcept; ---- [.small]#link:#beman-optional-optional-06-operator_assign-0e[_» more..._]# == Return Value optional& == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Copy assignment operator. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06[optional]& operator=(link:#beman-optional-optional-06[optional] const& rhs) noexcept = default; ---- == Return Value optional& == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Assignment operator. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06[optional<T&>]& operator=(link:#beman-optional-nullopt_t[nullopt_t] value) noexcept; ---- == Return Value optional& == Parameters [cols=2] |=== | Name | Description | *value* | The object to assign from |=== Applies a function to the stored value if there is one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr auto and_then(F&& f) const; ---- == Return Value auto == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns an iterator to the beginning of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06-iterator[optional<T&>::iterator] begin() const noexcept; ---- == Return Value iterator Converting copy assignment operator. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, U>) constexpr T& emplace(U&& u) noexcept(std::is_nothrow_constructible_v<T &, U>); ---- == Description If `rhs` has a value, assigns it to the stored value. Otherwise resets the stored value in `*this`. If `T&` can be constructed from a temporary, this assignment operator is deleted to prevent binding a temporary to a reference. == Return Value optional& == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | |=== Returns an iterator to the end of the optional. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr link:#beman-optional-optional-06-iterator[optional<T&>::iterator] end() const noexcept; ---- == Return Value iterator Checks if the optional has a value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool has_value() const noexcept; ---- == Return Value bool Returns a reference to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T& operator*() const noexcept; ---- == Return Value T& Returns a pointer to the stored value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T* operator‐>() const noexcept; ---- == Return Value T* Calls a function if the optional is empty. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr link:#beman-optional-optional-06[optional<T&>] or_else(F&& f) const; ---- == Return Value * optional * optional<T&> == Template Parameters [cols=2] |=== | Name | Description | *F* | | *T* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Resets the optional to an empty state. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr void reset() noexcept; ---- Swaps the contents of this optional with another. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr void swap(link:#beman-optional-optional-06[optional]& rhs) noexcept; ---- == Parameters [cols=2] |=== | Name | Description | *rhs* | |=== Applies a function to the stored value if there is one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr link:#beman-optional-optional-03[optional<std::invoke_result_t<F, T&>>] transform(F&& f) const; ---- == Return Value optional<std::invoke_result_t<F, T&>> == Template Parameters [cols=2] |=== | Name | Description | *F* | |=== == Parameters [cols=2] |=== | Name | Description | *f* | |=== Returns the stored value if there is one, otherwise throws == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr T& value() const; ---- == Return Value T& Returns the stored value if there is one, otherwise returns `u`. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = std::remove_cv_t<T>> constexpr std::remove_cv_t<T> value_or(U&& u) const; ---- == Return Value std::remove_cv_t<T> == Template Parameters [cols=2] |=== | Name | Description | *U* | |=== == Parameters [cols=2] |=== | Name | Description | *u* | |=== Converts the optional to a boolean value. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr explicit operator bool() const noexcept; ---- == Return Value bool == Synopses Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< int = 0, class T> constexpr link:#beman-optional-optional-03[optional<std::decay_t<T>>] link:#beman-optional-make_optional-04[make_optional](T&& t) noexcept(std::is_nothrow_constructible_v<optional<std::decay_t<T>>, T>) requires std::is_constructible_v<std::decay_t<T>, T>; ---- [.small]#link:#beman-optional-make_optional-04[_» more..._]# [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename... Args> constexpr link:#beman-optional-optional-03[optional<T>] link:#beman-optional-make_optional-00[make_optional](Args...&&... args) noexcept(std::is_nothrow_constructible_v<T, Args...>) requires std::is_constructible_v<T, Args...>; ---- [.small]#link:#beman-optional-make_optional-00[_» more..._]# [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U, typename... Args> constexpr link:#beman-optional-optional-03[optional<T>] link:#beman-optional-make_optional-0f[make_optional]( std::initializer_list<U> il, Args...&&... args) noexcept(std::is_nothrow_constructible_v<T, std::initializer_list<U> &, Args...>) requires std::is_constructible_v<T, std::initializer_list<U>&, Args...>; ---- [.small]#link:#beman-optional-make_optional-0f[_» more..._]# == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< int = 0, class T> constexpr link:#beman-optional-optional-03[optional<std::decay_t<T>>] make_optional(T&& t) noexcept(std::is_nothrow_constructible_v<optional<std::decay_t<T>>, T>) requires std::is_constructible_v<std::decay_t<T>, T>; ---- == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename... Args> constexpr link:#beman-optional-optional-03[optional<T>] make_optional(Args...&&... args) noexcept(std::is_nothrow_constructible_v<T, Args...>) requires std::is_constructible_v<T, Args...>; ---- == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U, typename... Args> constexpr link:#beman-optional-optional-03[optional<T>] make_optional( std::initializer_list<U> il, Args...&&... args) noexcept(std::is_nothrow_constructible_v<T, std::initializer_list<U> &, Args...>) requires std::is_constructible_v<T, std::initializer_list<U>&, Args...>; ---- == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> constexpr void swap( link:#beman-optional-optional-03[optional<T>]& x, link:#beman-optional-optional-03[optional<T>]& y) noexcept(noexcept(lhs.swap(rhs))) requires std::is_move_constructible_v<T> && std::is_swappable_v<T>; ---- Equality operators == Synopses Declared in `<beman/optional/optional.hpp>` Equality operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_eq-08[operator==]( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_eq_rel<T, U>; ---- [.small]#link:#beman-optional-operator_eq-08[_» more..._]# Equality operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> constexpr bool link:#beman-optional-operator_eq-00[operator==]( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-nullopt_t[nullopt_t] rhs) noexcept; ---- [.small]#link:#beman-optional-operator_eq-00[_» more..._]# Equality operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_eq-09[operator==]( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_eq_rel<T, U>; ---- [.small]#link:#beman-optional-operator_eq-09[_» more..._]# Equality operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_eq-0b3[operator==]( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_eq_rel<T, U>; ---- [.small]#link:#beman-optional-operator_eq-0b3[_» more..._]# Equality operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator==( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_eq_rel<T, U>; ---- == Return Value `true` if the objects are equal, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Equality operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> constexpr bool operator==( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-nullopt_t[nullopt_t] rhs) noexcept; ---- == Return Value `true` if the objects are equal, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Equality operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator==( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_eq_rel<T, U>; ---- == Return Value `true` if the objects are equal, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Equality operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator==( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_eq_rel<T, U>; ---- == Return Value `true` if the objects are equal, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Inequality operators == Synopses Declared in `<beman/optional/optional.hpp>` Inequality operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_not_eq-0e[operator!=]( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_ne_rel<T, U>; ---- [.small]#link:#beman-optional-operator_not_eq-0e[_» more..._]# Inequality operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_not_eq-0d8[operator!=]( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_ne_rel<T, U>; ---- [.small]#link:#beman-optional-operator_not_eq-0d8[_» more..._]# Inequality operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_not_eq-0d5[operator!=]( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_ne_rel<T, U>; ---- [.small]#link:#beman-optional-operator_not_eq-0d5[_» more..._]# Inequality operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator!=( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_ne_rel<T, U>; ---- == Return Value `true` if the objects are not equal, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Inequality operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator!=( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_ne_rel<T, U>; ---- == Return Value `true` if the objects are not equal, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Inequality operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator!=( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_ne_rel<T, U>; ---- == Return Value `true` if the objects are not equal, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Less‐than operators == Synopses Declared in `<beman/optional/optional.hpp>` Less‐than operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_lt-0d[operator<]( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_lt_rel<T, U>; ---- [.small]#link:#beman-optional-operator_lt-0d[_» more..._]# Less‐than operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_lt-08[operator<]( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_lt_rel<T, U>; ---- [.small]#link:#beman-optional-operator_lt-08[_» more..._]# Less‐than operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_lt-04[operator<]( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_lt_rel<T, U>; ---- [.small]#link:#beman-optional-operator_lt-04[_» more..._]# Less‐than operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator<( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_lt_rel<T, U>; ---- == Return Value `true` if the left object is less than the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Less‐than operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator<( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_lt_rel<T, U>; ---- == Return Value `true` if the left object is less than the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Less‐than operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator<( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_lt_rel<T, U>; ---- == Return Value `true` if the left object is less than the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Less‐than‐or‐equal operators == Synopses Declared in `<beman/optional/optional.hpp>` Less‐than‐or‐equal operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_le-01[operator<=]( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_le_rel<T, U>; ---- [.small]#link:#beman-optional-operator_le-01[_» more..._]# Less‐than‐or‐equal operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_le-0f[operator<=]( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_le_rel<T, U>; ---- [.small]#link:#beman-optional-operator_le-0f[_» more..._]# Less‐than‐or‐equal operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_le-0c[operator<=]( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_le_rel<T, U>; ---- [.small]#link:#beman-optional-operator_le-0c[_» more..._]# Less‐than‐or‐equal operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator<=( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_le_rel<T, U>; ---- == Return Value `true` if the left object is less than or equal to the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Less‐than‐or‐equal operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator<=( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_le_rel<T, U>; ---- == Return Value `true` if the left object is less than or equal to the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Less‐than‐or‐equal operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator<=( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_le_rel<T, U>; ---- == Return Value `true` if the left object is less than or equal to the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Greater‐than operators == Synopses Declared in `<beman/optional/optional.hpp>` Greater‐than operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_gt-08[operator>]( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_gt_rel<T, U>; ---- [.small]#link:#beman-optional-operator_gt-08[_» more..._]# Greater‐than operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_gt-0d[operator>]( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_gt_rel<T, U>; ---- [.small]#link:#beman-optional-operator_gt-0d[_» more..._]# Greater‐than operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_gt-03[operator>]( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_gt_rel<T, U>; ---- [.small]#link:#beman-optional-operator_gt-03[_» more..._]# Greater‐than operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator>( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_gt_rel<T, U>; ---- == Return Value `true` if the left object is greater than the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Greater‐than operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator>( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_gt_rel<T, U>; ---- == Return Value `true` if the left object is greater than the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Greater‐than operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator>( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_gt_rel<T, U>; ---- == Return Value `true` if the left object is greater than the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Greater‐than‐or‐equal operators == Synopses Declared in `<beman/optional/optional.hpp>` Greater‐than‐or‐equal operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_ge-0f[operator>=]( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_ge_rel<T, U>; ---- [.small]#link:#beman-optional-operator_ge-0f[_» more..._]# Greater‐than‐or‐equal operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_ge-00[operator>=]( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_ge_rel<T, U>; ---- [.small]#link:#beman-optional-operator_ge-00[_» more..._]# Greater‐than‐or‐equal operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool link:#beman-optional-operator_ge-0d[operator>=]( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_ge_rel<T, U>; ---- [.small]#link:#beman-optional-operator_ge-0d[_» more..._]# Greater‐than‐or‐equal operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator>=( link:#beman-optional-optional-03[optional<T>] const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_ge_rel<T, U>; ---- == Return Value `true` if the left object is greater than or equal to the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Greater‐than‐or‐equal operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator>=( link:#beman-optional-optional-03[optional<T>] const& lhs, U const& rhs) requires detail::optional_ge_rel<T, U>; ---- == Return Value `true` if the left object is greater than or equal to the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Greater‐than‐or‐equal operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool operator>=( T const& lhs, link:#beman-optional-optional-03[optional<U>] const& rhs) requires detail::optional_ge_rel<T, U>; ---- == Return Value `true` if the left object is greater than or equal to the right object, `false` otherwise == Parameters [cols=2] |=== | Name | Description | *lhs* | The left operand | *rhs* | The right operand |=== Three‐way comparison operators == Synopses Declared in `<beman/optional/optional.hpp>` Three‐way comparison operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, std::three_way_comparable_with<T> U> constexpr std::compare_three_way_result_t<T, U> link:#beman-optional-operator_3way-0a[operator<=>]( link:#beman-optional-optional-03[optional<T>] const& x, link:#beman-optional-optional-03[optional<U>] const& y); ---- [.small]#link:#beman-optional-operator_3way-0a[_» more..._]# Three‐way comparison operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> constexpr std::strong_ordering link:#beman-optional-operator_3way-02[operator<=>]( link:#beman-optional-optional-03[optional<T>] const& x, link:#beman-optional-nullopt_t[nullopt_t] rhs) noexcept; ---- [.small]#link:#beman-optional-operator_3way-02[_» more..._]# Three‐way comparison operator [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> requires (!is_derived_from_optional<U>) && std::three_way_comparable_with<T, U> constexpr std::compare_three_way_result_t<T, U> link:#beman-optional-operator_3way-09[operator<=>]( link:#beman-optional-optional-03[optional<T>] const& x, U const& v); ---- [.small]#link:#beman-optional-operator_3way-09[_» more..._]# Three‐way comparison operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, std::three_way_comparable_with<T> U> constexpr std::compare_three_way_result_t<T, U> operator<=>( link:#beman-optional-optional-03[optional<T>] const& x, link:#beman-optional-optional-03[optional<U>] const& y); ---- == Return Value The relative order of the objects == Parameters [cols=2] |=== | Name | Description | *x* | The left operand | *y* | The right operand |=== Three‐way comparison operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> constexpr std::strong_ordering operator<=>( link:#beman-optional-optional-03[optional<T>] const& x, link:#beman-optional-nullopt_t[nullopt_t] rhs) noexcept; ---- == Return Value The relative order of the objects == Parameters [cols=2] |=== | Name | Description | *x* | The left operand | *rhs* | The right operand |=== Three‐way comparison operator == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> requires (!is_derived_from_optional<U>) && std::three_way_comparable_with<T, U> constexpr std::compare_three_way_result_t<T, U> operator<=>( link:#beman-optional-optional-03[optional<T>] const& x, U const& v); ---- == Return Value The relative order of the objects == Parameters [cols=2] |=== | Name | Description | *x* | The left operand | *v* | The right operand |=== == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr link:#beman-optional-in_place_t[in_place_t] in_place = in_place{}; ---- Tag to disengage optional objects. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- inline constexpr link:#beman-optional-nullopt_t[nullopt_t] nullopt = nullopt{nullopt_t::Tag::tag}; ---- == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> concept is_derived_from_optional = requires(const T& t) { // exposition only []<class U>(const optional<U>&) {}(t); }; ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#