folly::Optional::Optional

Constructors

Synopses

Declared in <folly/Optional.h>

Default-constructed Optionals are None.

constexpr
Optional() noexcept;
» more...

Copy-constructs an Optional from another Optional.

Optional(Optional const& src) = default;
» more...

Move-constructs an Optional, leaving the source empty.

Optional(Optional&& src) noexcept(/* see-below */);
» more...

Constructs an empty Optional from a None tag.

constexpr
Optional(None const& none) noexcept;
» more...

Constructs an Optional by copying a value into it.

constexpr
Optional(Value const& newValue) noexcept(/* see-below */);
» more...

Constructs an Optional from a coroutine promise return object.

Optional(/* implementation-defined */ const& p);
» more...

Constructs an Optional by moving a value into it.

constexpr
Optional(Value&& newValue) noexcept(/* see-below */);
» more...

Allow construction of Optional from a const std::optional.

template<typename U>
requires std::same_as<U, std::optional<Value>>
explicit
Optional(U const& newValue) noexcept(/* see-below */);
» more...

Allow construction of Optional from an rvalue std::optional.

template<typename U>
requires std::same_as<U, std::optional<Value>>
explicit
Optional(U&& newValue) noexcept(/* see-below */);
» more...

Creates an Optional with a value, where that value is constructed in-place.

template<typename... Args>
constexpr
explicit
Optional(
    std::in_place_t in_place,
    Args&&... args) noexcept(/* see-below */);
» more...

Creates an Optional with a value constructed in-place from an initializer list.

template<
    typename U,
    typename... Args>
constexpr
explicit
Optional(
    std::in_place_t in_place,
    std::initializer_list<U> il,
    Args&&... args) noexcept(/* see-below */);
» more...

Parameters

NameDescription
srcThe Optional to copy from.
noneThe None tag selecting the empty state.
newValueThe value to copy into the Optional.
pThe coroutine promise return object to bind to.
in_placeTag selecting in-place construction.
argsArguments forwarded to the value constructor.
ilInitializer list forwarded to the value constructor.