Constructors
Declared in <mrdocs/ADT/Optional.hpp>
Default-constructs to the “null” state.
constexpr
Optional() noexcept(default_ctor_noex_());
» more...
Copy constructor
constexpr
Optional(Optional const& other) = default;
» more...
Construct from another Optional with a convertible contained value.
template<typename U>
requires (!std::is_same_v<T, U>) && std::is_constructible_v<T, U const&>
&& ConstructFromContainedValue<U>
constexpr
explicit(!std::is_convertible_v<const U &, T>)
Optional(Optional<U> const& t) noexcept(/* see-below */);
» more...
Move constructor
constexpr
Optional(Optional&& other) = default;
» more...
Construct from another Optional rvalue with a convertible value.
template<typename U>
requires (!std::is_same_v<T, U>)
&& std::is_constructible_v<T, U> && ConstructFromContainedValue<U>
constexpr
explicit(!std::is_convertible_v<U, T>)
Optional(Optional<U>&& t) noexcept(std::is_nothrow_constructible_v<T, U>);
» more...
Construct from std::nullopt
constexpr
Optional(std::nullopt_t value) noexcept(default_ctor_noex_());
» more...
Construct from std::optional lvalue with convertible value.
template<typename U>
requires std::is_constructible_v<T, U const&> &&
ConstructFromContainedValue<U>
constexpr
explicit(!std::is_convertible_v<const U &, T>)
Optional(std::optional<U> const& t) noexcept(/* see-below */);
» more...
Construct from a value.
template<typename U = std::remove_cv_t<T>>
requires (!std::is_same_v<Optional, std::remove_cvref_t<U>>)
&& (!std::is_same_v<std::in_place_t, std::remove_cvref_t<U>>)
&& std::is_constructible_v<T, U>
&& NotConstructingBoolFromOptional<U>
constexpr
explicit(!std::is_convertible_v<U, T>)
Optional(U&& u) noexcept(std::is_nothrow_constructible_v<T, U>);
» more...
Construct from std::optional rvalue with convertible value.
template<typename U>
requires std::is_constructible_v<T, U> &&
ConstructFromContainedValue<U>
constexpr
explicit(!std::is_convertible_v<U, T>)
Optional(std::optional<U>&& t) noexcept(std::is_nothrow_constructible_v<T, U>);
» more...
In-place construct the contained value.
template<typename... Args>
requires std::is_constructible_v<T, Args...>
constexpr
explicit
Optional(
std::in_place_t,
Args&&... args) noexcept(/* see-below */);
» more...
In-place construct the contained value from an initializer list.
template<
typename U,
typename... Args>
requires std::is_constructible_v<T, std::initializer_list<U>&, Args...>
constexpr
explicit
Optional(
std::in_place_t,
std::initializer_list<U> il,
Args&&... args) noexcept(/* see-below */);
» more...
| Name | Description |
|---|---|
| t | Source optional. |
| u | The value to store. It must be convertible to T. |
| args | Arguments forwarded to T's constructor. |
| il | Initializer list forwarded to T's constructor. |