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;
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>);
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&>);
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;
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>);
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>);
Resets the optional to an empty state.
constexpr
optional<T>&
operator=(nullopt_t value) noexcept;
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>;
Return Value
optional&
Template Parameters
Name |
Description |
U |
Parameters
Name |
Description |
u |
Created with MrDocs