folly::Expected::Expected

Constructors

Synopses

Declared in <folly/Expected.h>

Default-constructs an Expected in the default (error) state.

template<
    class B = Base,
    class = decltype(B{})>
Expected() noexcept(noexcept(B{}));
» more...

Copy constructor.

Expected(Expected const& that) = default;
» more...

Move constructor.

Expected(Expected&& that) = default;
» more...

Deleted: construct from an error directly; use makeUnexpected instead.

Expected(Error const& err) = delete;
» more...

Deleted: construct from an error directly; use makeUnexpected instead.

Expected(Error&& err) = delete;
» more...

Constructs an Expected holding a copy of a value.

template<bool FollyRequires1273 = false>
constexpr
Expected(Value const& val) noexcept(noexcept(Value(val)));
» more...

Constructs an Expected in the error state from an Unexpected.

template<bool FollyRequires1345 = false>
constexpr
Expected(Unexpected<Error> const& err) noexcept(noexcept(Error(err.error())));
» more...

Constructs an Expected by moving a value into it.

template<bool FollyRequires1280 = false>
constexpr
Expected(Value&& val) noexcept(noexcept(Value(std::move(val))));
» more...

Constructs an Expected in the error state by moving an Unexpected.

template<bool FollyRequires1352 = false>
constexpr
Expected(Unexpected<Error>&& err) noexcept(noexcept(Error(std::move(err.error()))));
» more...

Constructs an Expected in the error state from a convertible Unexpected.

template<
    class OtherError,
    bool FollyRequires1360 = false>
constexpr
Expected(Unexpected<OtherError> const& err) noexcept(noexcept(Error(err.error())));
» more...

Constructs an Expected from a value convertible to the value type.

template<
    class T,
    bool FollyRequires1289 = false>
constexpr
Expected(T&& val) noexcept(noexcept(Value(static_cast<T &&>(val))));
» more...

Constructs an Expected in the error state by moving a convertible Unexpected.

template<
    class OtherError,
    bool FollyRequires1369 = false>
constexpr
Expected(Unexpected<OtherError>&& err) noexcept(noexcept(Error(std::move(err.error()))));
» more...

Converting constructor from an Expected with compatible types.

template<
    class V,
    class E,
    bool FollyRequires1266 = false>
Expected(Expected<V, E> that);
» more...

Constructs an Expected in the error state from a copied error.

template<bool FollyRequires1330 = false>
constexpr
Expected(
    unexpected_t tag,
    Error const& err) noexcept(noexcept(Error(err)));
» more...

Constructs an Expected in the error state from a moved error.

template<bool FollyRequires1338 = false>
constexpr
Expected(
    unexpected_t tag,
    Error&& err) noexcept(noexcept(Error(std::move(err))));
» more...

Constructs the value in place from the given arguments.

template<
    class... Ts,
    bool FollyRequires1298 = false>
constexpr
explicit
Expected(
    std::in_place_t tag,
    Ts&&... ts) noexcept(noexcept(Value(std::declval<Ts>()...)));
» more...

Constructs the value in place from an initializer list and arguments.

template<
    class U,
    class... Ts,
    bool FollyRequires1311 = false>
constexpr
explicit
Expected(
    std::in_place_t tag,
    std::initializer_list<U> il,
    Ts&&... ts) noexcept(noexcept(Value(std::declval<Ts>()...)));
» more...

Parameters

NameDescription
thatThe Expected to copy from.
errThe error operand.
valThe value to store.
tagTag selecting error-state construction.
tsArguments forwarded to the value constructor.
ilThe initializer list forwarded to the value constructor.