Reference

Namespaces

Name
beman

beman namespace

Namespaces

Name
optional

beman::optional namespace

Types

Name Description
bad_optional_access Exception thrown when trying to access the value of an empty optional
hash
hash<optional<T>>
in_place_t Tag type for in place construction
nullopt_t Tag type for nullopt construction
optional
optional<T&>

Functions

Name Description
make_optional
swap
operator== Equality operators
operator!= Inequality operators
operator< Less-than operators
operator<= Less-than-or-equal operators
operator> Greater-than operators
operator>= Greater-than-or-equal operators
operator<=> Three-way comparison operators

Variables

Name Description
in_place
nullopt Tag to disengage optional objects.

Concepts

Name
is_derived_from_optional

Namespaces

Name
optional

Types

Name Description
bad_optional_access Exception thrown when trying to access the value of an empty optional
hash
hash<optional<T>>
in_place_t Tag type for in place construction
nullopt_t Tag type for nullopt construction
optional
optional<T&>

Functions

Name Description
make_optional
swap
operator== Equality operators
operator!= Inequality operators
operator< Less-than operators
operator<= Less-than-or-equal operators
operator> Greater-than operators
operator>= Greater-than-or-equal operators
operator<=> Three-way comparison operators

Variables

Name Description
in_place
nullopt Tag to disengage optional objects.

Concepts

Name
is_derived_from_optional

Exception thrown when trying to access the value of an empty optional

Synopsis

Declared in <beman/optional/optional.hpp>
class bad_optional_access
    : public std::exception

Base Classes

Name Description
std::exception

Member Functions

Name Description
bad_optional_access [constructor]Construct a new bad optional access object
operator=
what [virtual]Get the error message for bad optional access

Construct a new bad optional access object

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
bad_optional_access() = default;

Synopsis

Declared in <__exception/exception.h>
[[__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>
virtual
char const*
what() const noexcept;

Return Value

const char*

Synopsis

Declared in <beman/optional/optional.hpp>
template<class T>
struct hash;

Synopsis

Declared in <beman/optional/optional.hpp>
template<class T>
struct hash<optional<T>>;

Tag type for in place construction

Synopsis

Declared in <beman/optional/optional.hpp>
struct in_place_t;

Member Functions

Name Description
in_place_t [constructor]Default constructor

Default constructor

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
explicit
in_place_t() = default;

Tag type for nullopt construction

Synopsis

Declared in <beman/optional/optional.hpp>
struct nullopt_t;

Enums

Name Description
Tag Tag type for nullopt_t construction

Member Functions

Name Description
nullopt_t [constructor]Construct a new nullopt_t object

Tag type for nullopt_t construction

Synopsis

Declared in <beman/optional/optional.hpp>
enum class Tag : int;

Members

Name
tag

Construct a new nullopt_t object

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
explicit
nullopt_t(Tag value) noexcept;

Description

constexpr for nullopt_t to be literal.

Parameters

Name Description
value The object to construct from

Synopsis

Declared in <beman/optional/optional.hpp>
template<class T>
class optional;

Types

Name Description
const_iterator Type alias for the const iterator type of the optional.
iterator Type alias for the iterator type of the optional.
value_type Type alias for the value type stored in the optional.

Member Functions

Name Description
optional [constructor]Constructors
~optional [destructor]Destructors
operator= Assignment operators
and_then Returns an optional containing the result of applying f to the stored value.
begin begin overloads
emplace emplace overloads
end end overloads
has_value Returns whether or not the optional has a value.
operator* Returns a reference to the stored value.
operator-> Returns a pointer to the stored value.
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.
reset Resets the optional to an empty state, destroying the stored value if there is one.
swap Swaps this optional with the other.
transform Returns an optional containing the result of applying f to the stored value, or a default value if there is no stored value.
value Returns a reference to the stored value.
value_or Returns a reference to the stored value.
operator bool Converts the optional to a boolean indicating whether it has a value.

Data Members

Name Description
_ [variant member]The empty state of the optional.
value_ [variant member]The stored value of the optional.

Friends

|===
Name Description
optional

Non-Member Functions

Name Description
operator!=Inequality operator
operator!=Inequality operator
operator<Less-than operator
operator<Less-than operator
operator<=Less-than-or-equal operator
operator<=Less-than-or-equal operator
operator<=>Three-way comparison operator
operator<=>Three-way comparison operator
operator<=>Three-way comparison operator
operator==Equality operator
operator==Equality operator
operator==Equality operator
operator>Greater-than operator
operator>Greater-than operator
operator>=Greater-than-or-equal operator
operator>=Greater-than-or-equal operator

Type alias for the const iterator type of the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
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>
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>
using value_type = T;

Constructors

Synopses

Declared in <beman/optional/optional.hpp>

Default constructs an empty optional.

constexpr
optional() noexcept;
» more...

Copy constructs the value from rhs if it has one.

constexpr
optional(optional const& other)
requires std::is_copy_constructible_v<T> && std::is_trivially_copy_constructible_v<T> = default;
» more...

Copy constructs the value from rhs if it has one.

constexpr
optional(optional const& rhs)
requires std::is_copy_constructible_v<T> && (!std::is_trivially_copy_constructible_v<T>);
» more...

Constructs the value from rhs if it has one.

template<class U>
constexpr
explicit(!std::is_convertible_v<U, T>)
optional(optional<U> const& rhs)
requires (detail::enable_from_other<T, U, const U&>);
» more...

Move constructs the value from rhs if it has one.

constexpr
optional(optional&& other)
requires std::is_move_constructible_v<T> && std::is_trivially_move_constructible_v<T> = default;
» more...

Move constructs the value from rhs if it has one.

constexpr
optional(optional&& rhs) noexcept(std::is_nothrow_move_constructible_v<T>)
requires std::is_move_constructible_v<T> && (!std::is_trivially_move_constructible_v<T>);
» more...

Constructs the value from rhs if it has one.

template<class U>
constexpr
explicit(!std::is_convertible_v<U, T>)
optional(optional<U>&& rhs)
requires (detail::enable_from_other<T, U, U &&>);
» more...

Constructs an empty optional.

constexpr
optional(nullopt_t value) noexcept;
» more...

Constructs the value from u, forwarding it if necessary.

template<class U = T>
constexpr
explicit(!std::is_convertible_v<U, T>)
optional(U&& u)
requires detail::enable_forward_value<T, U>;
» more...

Constructs the value in-place using the given arguments.

template<class... Args>
constexpr
explicit
optional(
    in_place_t,
    Args...&&... args)
requires std::is_constructible_v<T, Args...>;
» more...

Constructs the value in-place using the given arguments.

template<
    class U,
    class... Args>
constexpr
explicit
optional(
    in_place_t,
    std::initializer_list<U> il,
    Args...&&... args)
requires std::is_constructible_v<T, std::initializer_list<U>&, Args&&...>;
» more...

Default constructs an empty optional.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional() noexcept;

Copy constructs the value from rhs if it has one.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional(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

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>
constexpr
optional(optional const& rhs)
requires std::is_copy_constructible_v<T> && (!std::is_trivially_copy_constructible_v<T>);

Parameters

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>
template<class U>
constexpr
explicit(!std::is_convertible_v<U, T>)
optional(optional<U> const& rhs)
requires (detail::enable_from_other<T, U, const U&>);

Description

Converting copy constructor.

Parameters

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>
constexpr
optional(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

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>
constexpr
optional(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

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>
template<class U>
constexpr
explicit(!std::is_convertible_v<U, T>)
optional(optional<U>&& rhs)
requires (detail::enable_from_other<T, U, U &&>);

Description

Converting move constructor.

Parameters

Name Description
rhs The object to move construct from

Constructs an empty optional.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional(nullopt_t value) noexcept;

Parameters

Name Description
value The object to construct from

Constructs the value from u, forwarding it if necessary.

Synopsis

Declared in <beman/optional/optional.hpp>
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

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>
template<class... Args>
constexpr
explicit
optional(
    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>
template<
    class U,
    class... Args>
constexpr
explicit
optional(
    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.

constexpr
~optional()
requires std::is_trivially_destructible_v<T> = default;
» more...

Destroys the optional and its value if it has one.

constexpr
~optional()
requires (!std::is_trivially_destructible_v<T>);
» more...

Destructs the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
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>
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.

constexpr
optional&
operator=(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;
» more...

Copy assigns the value from rhs if it has one.

constexpr
optional<T>&
operator=(optional const& rhs)
requires std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T> &&
             (!std::is_trivially_copy_assignable_v<T>);
» more...

Assigns the stored value from rhs if it has one, destroying the old value if there

template<class U>
constexpr
optional<T>&
operator=(optional<U> const& rhs)
requires (detail::enable_assign_from_other<T, U, const U&>);
» more...

Move assigns the value from rhs if it has one.

constexpr
optional&
operator=(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;
» more...

Move assigns the value from rhs if it has one.

constexpr
optional<T>&
operator=(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>);
» more...

Assigns the stored value from rhs if it has one, destroying the old value if there

template<class U>
constexpr
optional<T>&
operator=(optional<U>&& rhs)
requires (detail::enable_assign_from_other<T, U, U>);
» more...

Resets the optional to an empty state.

constexpr
optional<T>&
operator=(nullopt_t value) noexcept;
» more...

Assigns the stored value from u, destroying the old value if there

template<class U = T>
constexpr
optional<T>&
operator=(U&& u)
requires detail::enable_assign_forward<T, U>;
» more...

Return Value

optional&

Copy assigns the value from rhs if it has one.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional&
operator=(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

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>
constexpr
optional<T>&
operator=(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

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>
template<class U>
constexpr
optional<T>&
operator=(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

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>
constexpr
optional&
operator=(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

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>
constexpr
optional<T>&
operator=(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

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>
template<class U>
constexpr
optional<T>&
operator=(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

Name Description
rhs The object to move assign from

Resets the optional to an empty state.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional<T>&
operator=(nullopt_t value) noexcept;

Return Value

Reference to the current object

Parameters

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>
template<class U = T>
constexpr
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&

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.

template<class F>
constexpr
auto
and_then(F&& f) &;
» more...

Returns an optional containing the result of applying f to the stored value.

template<class F>
constexpr
auto
and_then(F&& f) &&;
» more...

Returns an optional containing the result of applying f to the stored value.

template<class F>
constexpr
auto
and_then(F&& f) const &;
» more...

Returns an optional containing the result of applying f to the stored value.

template<class F>
constexpr
auto
and_then(F&& f) const &&;
» more...

Return Value

auto

Returns an optional containing the result of applying f to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class F>
constexpr
auto
and_then(F&& f) &;

Return Value

auto

Returns an optional containing the result of applying f to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class F>
constexpr
auto
and_then(F&& f) &&;

Return Value

auto

Returns an optional containing the result of applying f to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class F>
constexpr
auto
and_then(F&& f) const &;

Return Value

auto

Returns an optional containing the result of applying f to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class F>
constexpr
auto
and_then(F&& f) const &&;

Return Value

auto

begin overloads

Synopses

Declared in <beman/optional/optional.hpp>

Returns an iterator to the beginning of the optional.

constexpr
optional<T>::iterator
begin() noexcept;
» more...

Returns a const iterator to the beginning of the optional.

constexpr
optional<T>::const_iterator
begin() const noexcept;
» more...

Return Value

const_iterator

Returns an iterator to the beginning of the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
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>
constexpr
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

template<class... Args>
constexpr
T&
emplace(Args...&&... args);
» more...

Constructs the value in-place using the given arguments, destroying the current one if there

template<
    class U,
    class... Args>
constexpr
T&
emplace(
    std::initializer_list<U> il,
    Args...&&... args);
» more...

Return Value

T&

Constructs the value in-place, destroying the current one if there

Synopsis

Declared in <beman/optional/optional.hpp>
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&

Constructs the value in-place using the given arguments, destroying the current one if there

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    class U,
    class... Args>
constexpr
T&
emplace(
    std::initializer_list<U> il,
    Args...&&... args);

Return Value

T&

end overloads

Synopses

Declared in <beman/optional/optional.hpp>

Returns an iterator to the end of the optional.

constexpr
optional<T>::iterator
end() noexcept;
» more...

Returns a const iterator to the end of the optional.

constexpr
optional<T>::const_iterator
end() const noexcept;
» more...

Return Value

const_iterator

Returns an iterator to the end of the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
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>
constexpr
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>
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.

constexpr
T&
operator*() &;
» more...

Returns a reference to the stored value.

constexpr
T const&
operator*() const &;
» more...

Returns a reference to the stored value.

constexpr
T&&
operator*() &&;
» more...

Return Value

Returns a reference to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
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>
constexpr
T const&
operator*() const &;

Return Value

const T&

Returns a reference to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
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.

constexpr
T const*
operator->() const;
» more...

Returns a pointer to the stored value.

constexpr
T*
operator->();
» more...

Return Value

T*

Returns a pointer to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
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>
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.

template<class F>
constexpr
optional<T>
or_else(F&& f) const &;
» 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.

template<class F>
constexpr
optional<T>
or_else(F&& f) &&;
» more...

Return Value

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>
template<class F>
constexpr
optional<T>
or_else(F&& f) const &;

Return Value

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>
template<class F>
constexpr
optional<T>
or_else(F&& f) &&;

Return Value

Resets the optional to an empty state, destroying the stored value if there is one.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
void
reset() noexcept;

Swaps this optional with the other.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
void
swap(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.

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.

template<class F>
constexpr
auto
transform(F&& f) &;
» more...

Returns an optional containing the result of applying f to the stored value, or a default value if there is no stored value.

template<class F>
constexpr
auto
transform(F&& f) &&;
» more...

Returns an optional containing the result of applying f to the stored value, or a default value if there is no stored value.

template<class F>
constexpr
auto
transform(F&& f) const &;
» more...

Returns an optional containing the result of applying f to the stored value, or a default value if there is no stored value.

template<class F>
constexpr
auto
transform(F&& f) const &&;
» more...

Return Value

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>
template<class F>
constexpr
auto
transform(F&& f) &;

Description

Carries out some operation on the stored object if there is one.

Return Value

optional

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>
template<class F>
constexpr
auto
transform(F&& f) &&;

Return Value

auto

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>
template<class F>
constexpr
auto
transform(F&& f) const &;

Return Value

auto

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>
template<class F>
constexpr
auto
transform(F&& f) const &&;

Return Value

auto

Returns a reference to the stored value.

Synopses

Declared in <beman/optional/optional.hpp>

Returns a reference to the stored value.

constexpr
T&
value() &;
» more...

Returns a reference to the stored value.

constexpr
T const&
value() const &;
» more...

Returns a reference to the stored value.

constexpr
T&&
value() &&;
» more...

Return Value

Returns a reference to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
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>
constexpr
T const&
value() const &;

Return Value

const T&

Returns a reference to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
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.

template<class U = std::remove_cv_t<T>>
constexpr
T
value_or(U&& u) const &;
» more...

Returns a reference to the stored value.

template<class U = std::remove_cv_t<T>>
constexpr
T
value_or(U&& u) &&;
» more...

Return Value

T

Returns a reference to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
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

Returns a reference to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class U = std::remove_cv_t<T>>
constexpr
T
value_or(U&& u) &&;

Return Value

T

Converts the optional to a boolean indicating whether it has a value.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
explicit
operator bool() const noexcept;

Return Value

bool

The empty state of the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
empty _ = {};

The stored value of the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
T value_;

Synopsis

Declared in <beman/optional/optional.hpp>
template<class T>
class optional<T&>;

Types

Name Description
iterator The type of the iterator for the optional.
value_type The type of the value stored in the optional.

Member Functions

Name Description
optional [constructor]Constructors
~optional [destructor]Destructor.
operator= Assignment operators
and_then Applies a function to the stored value if there is one.
begin Returns an iterator to the beginning of the optional.
emplace Emplaces a new value in the optional, destroying the current one if
end Returns an iterator to the end of the optional.
has_value Checks if the optional has a value.
operator* Returns a reference to the stored value.
operator-> Returns a pointer to the stored value.
or_else Calls a function if the optional is empty.
reset Resets the optional to an empty state.
swap Swaps the contents of this optional with another.
transform Applies a function to the stored value if there is one.
value Returns the stored value if there is one, otherwise throws
value_or Returns the stored value if there is one, otherwise returns u.
operator bool Converts the optional to a boolean value.

Friends

|===
Name Description
optional

The type of the iterator for the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
using iterator = /* implementation-defined */::contiguous_iterator<T, optional>;

The type of the value stored in the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
using value_type = T;

Constructors

Synopses

Declared in <beman/optional/optional.hpp>

Default constructor.

constexpr
optional() noexcept = default;
» more...

Copy constructor.

constexpr
optional(optional const& rhs) noexcept = default;
» more...

Constructs an empty optional.

constexpr
optional(nullopt_t value) noexcept;
» more...

Constructs an optional from another optional of type U

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(optional<U>& rhs) = delete;
» more...

Constructs an optional from another optional of type U.

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(optional<U>& rhs) noexcept(std::is_nothrow_constructible_v<T &, U &>);
» more...

Constructs an optional from another optional of type U

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(optional<U> const& rhs) = delete;
» more...

Constructs an optional from another optional of type U.

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(optional<U> const& rhs) noexcept(std::is_nothrow_constructible_v<T &, const U &>);
» more...

Construct from a U

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>);
» more...

Constructs an optional from a U, but deletes the constructor if

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;
» more...

Constructs an optional from another optional of type U

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(optional<U>&& rhs) = delete;
» more...

Constructs an optional from another optional of type U.

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(optional<U>&& rhs) noexcept(noexcept(std::is_nothrow_constructible_v<T &, U>));
» more...

Constructs an optional from another optional of type U

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(optional<U> const&& rhs) = delete;
» more...

Constructs an optional from another optional of type U.

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(optional<U> const&& rhs) noexcept(noexcept(std::is_nothrow_constructible_v<T &, const U>));
» more...

In-place constructor.

template<class Arg>
requires (std::is_constructible_v<T&, Arg> && !detail::reference_constructs_from_temporary_v<T&, Arg>)
constexpr
explicit
optional(
    in_place_t,
    Arg&& arg);
» more...

Default constructor.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional() noexcept = default;

Copy constructor.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional(optional const& rhs) noexcept = default;

Description

Constructs an empty optional if the rhs is empty, otherwise constructs the stored value from the rhs.

Parameters

Name Description
rhs The object to copy construct from

Constructs an empty optional.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional(nullopt_t value) noexcept;

Parameters

Name Description
value The object to construct from

Constructs an optional from another optional of type U

Synopsis

Declared in <beman/optional/optional.hpp>
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(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.

Constructs an optional from another optional of type U.

Synopsis

Declared in <beman/optional/optional.hpp>
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(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.

Constructs an optional from another optional of type U

Synopsis

Declared in <beman/optional/optional.hpp>
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(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.

Constructs an optional from another optional of type U.

Synopsis

Declared in <beman/optional/optional.hpp>
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(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.

Construct from a U

Synopsis

Declared in <beman/optional/optional.hpp>
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.

Constructs an optional from a U, but deletes the constructor if

Synopsis

Declared in <beman/optional/optional.hpp>
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;

Parameters

Name Description
u The object to move construct from

Constructs an optional from another optional of type U

Synopsis

Declared in <beman/optional/optional.hpp>
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(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.

Constructs an optional from another optional of type U.

Synopsis

Declared in <beman/optional/optional.hpp>
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(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.

Constructs an optional from another optional of type U

Synopsis

Declared in <beman/optional/optional.hpp>
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(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.

Constructs an optional from another optional of type U.

Synopsis

Declared in <beman/optional/optional.hpp>
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(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.

In-place constructor.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class Arg>
requires (std::is_constructible_v<T&, Arg> && !detail::reference_constructs_from_temporary_v<T&, Arg>)
constexpr
explicit
optional(
    in_place_t,
    Arg&& arg);

Destructor.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
~optional() = default;

Description

Does not destroy the stored value, as it is a reference.

Assignment operators

Synopses

Declared in <beman/optional/optional.hpp>

Assignment operator.

constexpr
optional&
operator=(optional const& rhs) noexcept = default;
» more...

Nullopt assignment operator.

constexpr
optional<T&>&
operator=(nullopt_t value) noexcept;
» more...

Return Value

optional&

Assignment operator.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional&
operator=(optional const& rhs) noexcept = default;

Description

If rhs has a value, assigns it to the stored value. Otherwise resets the stored value in *this.

Return Value

optional&

Nullopt assignment operator.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional<T&>&
operator=(nullopt_t value) noexcept;

Description

Destroys the current value if there is one, and leaves the optional in an empty state.

Return Value

optional&

Parameters

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>
template<class F>
constexpr
auto
and_then(F&& f) const;

Description

The return type is the same as

{std::invoke_result_t<F, T&>}, but wrapped in an optional. The function \p f must return an optional type.

Return Value

auto

Returns an iterator to the beginning of the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional<T&>::iterator
begin() const noexcept;

Return Value

iterator

Emplaces a new value in the optional, destroying the current one if

Synopsis

Declared in <beman/optional/optional.hpp>
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

Constructs the stored value from u if it is convertible to T&.

Return Value

T&

Returns an iterator to the end of the optional.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
optional<T&>::iterator
end() const noexcept;

Return Value

iterator

Checks if the optional has a value.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
bool
has_value() const noexcept;

Return Value

bool

Returns a reference to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
T&
operator*() const noexcept;

Return Value

T&

Returns a pointer to the stored value.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
T*
operator->() const noexcept;

Return Value

T*

Calls a function if the optional is empty.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class F>
constexpr
optional<T&>
or_else(F&& f) const;

Description

The return type is the same as the return type of f, which must return an optional type.

Return Value

Resets the optional to an empty state.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
void
reset() noexcept;

Swaps the contents of this optional with another.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
void
swap(optional& rhs) noexcept;

Applies a function to the stored value if there is one.

Synopsis

Declared in <beman/optional/optional.hpp>
template<class F>
constexpr
optional<std::invoke_result_t<F, T&>>
transform(F&& f) const;

Description

The return type is the same as

{std::invoke_result_t<F, T&>}, but wrapped in an optional.

Return Value

optional<std::invoke_result_t<F, T&>>

Returns the stored value if there is one, otherwise throws

Synopsis

Declared in <beman/optional/optional.hpp>
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>
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>

Converts the optional to a boolean value.

Synopsis

Declared in <beman/optional/optional.hpp>
constexpr
explicit
operator bool() const noexcept;

Return Value

bool

Synopses

Declared in <beman/optional/optional.hpp>
template<
    int = 0,
    class T>
constexpr
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>;
» more...
template<
    typename T,
    typename... Args>
constexpr
optional<T>
make_optional(Args...&&... args) noexcept(std::is_nothrow_constructible_v<T, Args...>)
requires std::is_constructible_v<T, Args...>;
» more...
template<
    typename T,
    typename U,
    typename... Args>
constexpr
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...>;
» more...

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    int = 0,
    class T>
constexpr
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>
template<
    typename T,
    typename... Args>
constexpr
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>
template<
    typename T,
    typename U,
    typename... Args>
constexpr
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>
template<class T>
constexpr
void
swap(
    optional<T>& x,
    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

template<
    typename T,
    typename U>
constexpr
bool
operator==(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_eq_rel<T, U>;
» more...

Equality operator

template<class T>
constexpr
bool
operator==(
    optional<T> const& lhs,
    nullopt_t rhs) noexcept;
» more...

Equality operator

template<
    typename T,
    typename U>
constexpr
bool
operator==(
    optional<T> const& lhs,
    U const& rhs)
requires detail::optional_eq_rel<T, U>;
» more...

Equality operator

template<
    typename T,
    typename U>
constexpr
bool
operator==(
    T const& lhs,
    optional<U> const& rhs)
requires detail::optional_eq_rel<T, U>;
» more...

Equality operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator==(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_eq_rel<T, U>;

Return Value

true if the objects are equal, false otherwise

Parameters

Name Description
lhs The left operand
rhs The right operand

Equality operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<class T>
constexpr
bool
operator==(
    optional<T> const& lhs,
    nullopt_t rhs) noexcept;

Return Value

true if the objects are equal, false otherwise

Parameters

Name Description
lhs The left operand
rhs The right operand

Equality operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator==(
    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

Name Description
lhs The left operand
rhs The right operand

Equality operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator==(
    T const& lhs,
    optional<U> const& rhs)
requires detail::optional_eq_rel<T, U>;

Return Value

true if the objects are equal, false otherwise

Parameters

Name Description
lhs The left operand
rhs The right operand

Inequality operators

Synopses

Declared in <beman/optional/optional.hpp>

Inequality operator

template<
    typename T,
    typename U>
constexpr
bool
operator!=(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_ne_rel<T, U>;
» more...

Inequality operator

template<
    typename T,
    typename U>
constexpr
bool
operator!=(
    optional<T> const& lhs,
    U const& rhs)
requires detail::optional_ne_rel<T, U>;
» more...

Inequality operator

template<
    typename T,
    typename U>
constexpr
bool
operator!=(
    T const& lhs,
    optional<U> const& rhs)
requires detail::optional_ne_rel<T, U>;
» more...

Inequality operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator!=(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_ne_rel<T, U>;

Return Value

true if the objects are not equal, false otherwise

Parameters

Name Description
lhs The left operand
rhs The right operand

Inequality operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator!=(
    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

Name Description
lhs The left operand
rhs The right operand

Inequality operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator!=(
    T const& lhs,
    optional<U> const& rhs)
requires detail::optional_ne_rel<T, U>;

Return Value

true if the objects are not equal, false otherwise

Parameters

Name Description
lhs The left operand
rhs The right operand

Less-than operators

Synopses

Declared in <beman/optional/optional.hpp>

Less-than operator

template<
    typename T,
    typename U>
constexpr
bool
operator<(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_lt_rel<T, U>;
» more...

Less-than operator

template<
    typename T,
    typename U>
constexpr
bool
operator<(
    optional<T> const& lhs,
    U const& rhs)
requires detail::optional_lt_rel<T, U>;
» more...

Less-than operator

template<
    typename T,
    typename U>
constexpr
bool
operator<(
    T const& lhs,
    optional<U> const& rhs)
requires detail::optional_lt_rel<T, U>;
» more...

Less-than operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator<(
    optional<T> const& lhs,
    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

Name Description
lhs The left operand
rhs The right operand

Less-than operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator<(
    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

Name Description
lhs The left operand
rhs The right operand

Less-than operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator<(
    T const& lhs,
    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

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

template<
    typename T,
    typename U>
constexpr
bool
operator<=(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_le_rel<T, U>;
» more...

Less-than-or-equal operator

template<
    typename T,
    typename U>
constexpr
bool
operator<=(
    optional<T> const& lhs,
    U const& rhs)
requires detail::optional_le_rel<T, U>;
» more...

Less-than-or-equal operator

template<
    typename T,
    typename U>
constexpr
bool
operator<=(
    T const& lhs,
    optional<U> const& rhs)
requires detail::optional_le_rel<T, U>;
» more...

Less-than-or-equal operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator<=(
    optional<T> const& lhs,
    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

Name Description
lhs The left operand
rhs The right operand

Less-than-or-equal operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator<=(
    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

Name Description
lhs The left operand
rhs The right operand

Less-than-or-equal operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator<=(
    T const& lhs,
    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

Name Description
lhs The left operand
rhs The right operand

Greater-than operators

Synopses

Declared in <beman/optional/optional.hpp>

Greater-than operator

template<
    typename T,
    typename U>
constexpr
bool
operator>(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_gt_rel<T, U>;
» more...

Greater-than operator

template<
    typename T,
    typename U>
constexpr
bool
operator>(
    optional<T> const& lhs,
    U const& rhs)
requires detail::optional_gt_rel<T, U>;
» more...

Greater-than operator

template<
    typename T,
    typename U>
constexpr
bool
operator>(
    T const& lhs,
    optional<U> const& rhs)
requires detail::optional_gt_rel<T, U>;
» more...

Greater-than operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator>(
    optional<T> const& lhs,
    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

Name Description
lhs The left operand
rhs The right operand

Greater-than operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator>(
    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

Name Description
lhs The left operand
rhs The right operand

Greater-than operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator>(
    T const& lhs,
    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

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

template<
    typename T,
    typename U>
constexpr
bool
operator>=(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_ge_rel<T, U>;
» more...

Greater-than-or-equal operator

template<
    typename T,
    typename U>
constexpr
bool
operator>=(
    optional<T> const& lhs,
    U const& rhs)
requires detail::optional_ge_rel<T, U>;
» more...

Greater-than-or-equal operator

template<
    typename T,
    typename U>
constexpr
bool
operator>=(
    T const& lhs,
    optional<U> const& rhs)
requires detail::optional_ge_rel<T, U>;
» more...

Greater-than-or-equal operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator>=(
    optional<T> const& lhs,
    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

Name Description
lhs The left operand
rhs The right operand

Greater-than-or-equal operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator>=(
    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

Name Description
lhs The left operand
rhs The right operand

Greater-than-or-equal operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    typename U>
constexpr
bool
operator>=(
    T const& lhs,
    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

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

template<
    typename T,
    std::three_way_comparable_with<T> U>
constexpr
std::compare_three_way_result_t<T, U>
operator<=>(
    optional<T> const& x,
    optional<U> const& y);
» more...

Three-way comparison operator

template<class T>
constexpr
std::strong_ordering
operator<=>(
    optional<T> const& x,
    nullopt_t rhs) noexcept;
» more...

Three-way comparison operator

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<=>(
    optional<T> const& x,
    U const& v);
» more...

Three-way comparison operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<
    typename T,
    std::three_way_comparable_with<T> U>
constexpr
std::compare_three_way_result_t<T, U>
operator<=>(
    optional<T> const& x,
    optional<U> const& y);

Return Value

The relative order of the objects

Parameters

Name Description
x The left operand
y The right operand

Three-way comparison operator

Synopsis

Declared in <beman/optional/optional.hpp>
template<class T>
constexpr
std::strong_ordering
operator<=>(
    optional<T> const& x,
    nullopt_t rhs) noexcept;

Return Value

The relative order of the objects

Parameters

Name Description
x The left operand
rhs The right operand

Three-way comparison operator

Synopsis

Declared in <beman/optional/optional.hpp>
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<=>(
    optional<T> const& x,
    U const& v);

Return Value

The relative order of the objects

Parameters

Name Description
x The left operand
v The right operand

Synopsis

Declared in <beman/optional/optional.hpp>
inline constexpr in_place_t in_place = in_place{};

Tag to disengage optional objects.

Synopsis

Declared in <beman/optional/optional.hpp>
inline constexpr nullopt_t nullopt = nullopt{nullopt_t::Tag::tag};

Synopsis

Declared in <beman/optional/optional.hpp>
template<class T>
concept is_derived_from_optional = requires(const T& t) { // exposition only
    []<class U>(const optional<U>&) {}(t);
};

Created with MrDocs