Types
-
basic_outcome<T, EC, EP, NoValuePolicy>
A type carrying one of (i) a successful
T
(ii) a disappointmentEC
(iii) a failureEP
(iv) both a disappointmentEC
and a failureEP
, withNoValuePolicy
specifying what to do if one tries to read state which isn’t there.-
basic_outcome() = delete
The default constructor (disabled).
-
basic_outcome(basic_outcome &&)
Move constructor. Constexpr, triviality and noexcept propagating.
-
basic_outcome(const basic_outcome &)
Copy constructor. Constexpr, triviality and noexcept propagating.
-
basic_outcome &operator=(basic_outcome &&)
Move assignment. Constexpr, triviality and noexcept propagating.
-
basic_outcome &operator=(const basic_outcome &)
Copy assignment. Constexpr, triviality and noexcept propagating.
-
~basic_outcome()
Destructor. Constexpr, triviality and noexcept propagating.
-
basic_outcome(Args...) = delete
Disabling catchall constructor used to give useful diagnostic error when trying to use non-inplace constructors when
predicate::constructors_enabled
is false. -
basic_outcome(X &&) = delete
Disabling implicit constructor used to give useful diagnostic error when trying to use implicit constructors when
predicate::implicit_constructors_enabled
is false. -
basic_outcome(R &&)
Implicit
value_type
constructor. Available ifpredicate::enable_value_converting_constructor<R>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(S &&)
Implicit
error_type
constructor. Available ifpredicate::enable_error_converting_constructor<S>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(ErrorCondEnum &&)
Implicit
error_type
fromErrorCondEnum
constructor. Available ifpredicate::enable_error_condition_converting_constructor<ErrorCondEnum>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(P &&)
Implicit
exception_type
constructor. Available ifpredicate::enable_exception_converting_constructor<P>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(S &&, P &&)
Implicit
error_type
+exception_type
constructor. Available ifpredicate::enable_error_exception_converting_constructor<S, P>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(ValueOrError<T, E> &&)
Explicit converting constructor from
ValueOrError<T, E>
concept matching types. Available ifconvert::value_or_error<>
permits it. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(const basic_outcome<A, B, C, D> &)
Explicit converting copy constructor from compatible
basic_outcome
. Available ifpredicate::enable_compatible_conversion<A, B, C, D>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(basic_outcome<A, B, C, D> &&)
Explicit converting move constructor from compatible
basic_outcome
. Available ifpredicate::enable_compatible_conversion<A, B, C, D>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(const basic_result<A, B, C> &)
Explicit converting copy constructor from compatible
basic_result
. Available ifpredicate::enable_compatible_conversion<A, B, void, C>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(basic_result<A, B, C> &&)
Explicit converting move constructor from compatible
basic_result
. Available ifpredicate::enable_compatible_conversion<A, B, void, C>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(const basic_result<A, B, C> &)
Explicit converting copy constructor from compatible
basic_result
. Available ifpredicate::enable_make_error_code_compatible_conversion<A, B, void, C>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(basic_result<A, B, C> &&)
Explicit converting move constructor from compatible
basic_result
. Available ifpredicate::enable_make_error_code_compatible_conversion<A, B, void, C>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(in_place_type_t<value_type_if_enabled>, Args ...)
Explicit inplace value constructor. Available if
predicate::enable_inplace_value_constructor<Args ...>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(in_place_type_t<value_type_if_enabled>, std::initializer_list<U>, Args ...)
Explicit inplace value constructor. Available if
predicate::enable_inplace_value_constructor<std::initializer_list<U>, Args ...>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(in_place_type_t<error_type_if_enabled>, Args ...)
Explicit inplace error constructor. Available if
predicate::enable_inplace_error_constructor<Args ...>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(in_place_type_t<error_type_if_enabled>, std::initializer_list<U>, Args ...)
Explicit inplace error constructor. Available if
predicate::enable_inplace_error_constructor<std::initializer_list<U>, Args ...>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(in_place_type_t<exception_type_if_enabled>, Args ...)
Explicit inplace exception constructor. Available if
predicate::enable_inplace_exception_constructor<Args ...>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_outcome(in_place_type_t<exception_type_if_enabled>, std::initializer_list<U>, Args ...)
Explicit inplace exception constructor. Available if
predicate::enable_inplace_exception_constructor<std::initializer_list<U>, Args ...>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(A1 &&, A2 &&, Args ...)
Implicit inplace value or error or exception constructor. Available if
predicate::enable_inplace_value_error_exception_constructor<A1, A2, Args ...>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(const success_type<T> &)
Implicit value-from-success-type-sugar copy constructor. Available if
predicate::enable_compatible_conversion<T, void, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_outcome(success_type<T> &&)
Implicit value-from-success-type-sugar move constructor. Available if
predicate::enable_compatible_conversion<T, void, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_outcome(const failure_type<EC> &)
Implicit error-from-failure-type-sugar copy constructor. Available if
predicate::enable_compatible_conversion<void, EC, void, void>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(failure_type<EC> &&)
Implicit error-from-failure-type-sugar move constructor. Available if
predicate::enable_compatible_conversion<void, EC, void, void>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(const failure_type<EC> &)
Implicit error-from-failure-type-sugar copy constructor. Available if
predicate::enable_make_error_code_compatible_conversion<void, EC, void, void>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(failure_type<EC> &&)
Implicit error-from-failure-type-sugar move constructor. Available if
predicate::enable_make_error_code_compatible_conversion<void, EC, void, void>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(const failure_type<EP> &)
Implicit exception-from-failure-type-sugar copy constructor. Available if
predicate::enable_compatible_conversion<void, void, EP, void>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(failure_type<EP> &&)
Implicit exception-from-failure-type-sugar move constructor. Available if
predicate::enable_compatible_conversion<void, void, EP, void>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(const failure_type<EC, EP> &)
Implicit error-and-exception-from-failure-type-sugar copy constructor. Available if
predicate::enable_compatible_conversion<void, EC, EP, void>
is true. Constexpr, triviality and noexcept propagating. -
basic_outcome(failure_type<EC, EP> &&)
Implicit error-and-exception-from-failure-type-sugar move constructor. Available if
predicate::enable_compatible_conversion<void, EC, EP, void>
is true. Constexpr, triviality and noexcept propagating. -
explicit operator bool() const noexcept
Returns true if a value is present. Constexpr, never throws.
-
bool has_value() const noexcept
Returns true if a value is present. Constexpr, never throws.
-
bool has_error() const noexcept
Returns true if an error is present. Constexpr, never throws.
-
bool has_exception() const noexcept
Returns true if an exception is present. Constexpr, never throws.
-
bool has_failure() const noexcept
Returns true if there is either an error or an exception. Constexpr, never throws.
-
value_type &assume_value() & noexcept
Narrow contract lvalue reference observer of any value present. Constexpr propagating, never throws.
-
const value_type &assume_value() const & noexcept
Narrow contract const lvalue reference observer of any value present. Constexpr propagating, never throws.
-
value_type &&assume_value() && noexcept
Narrow contract rvalue reference observer of any value present. Constexpr propagating, never throws.
-
const value_type &&assume_value() const && noexcept
Narrow contract const rvalue reference observer of any value present. Constexpr propagating, never throws.
-
value_type &value() &
Wide contract lvalue reference observer of any value present. Constexpr propagating.
-
const value_type &value() const &
Wide contract const lvalue reference observer of any value present. Constexpr propagating.
-
value_type &&value() &&
Wide contract rvalue reference observer of any value present. Constexpr propagating.
-
const value_type &&value() const &&
Wide contract const rvalue reference observer of any value present. Constexpr propagating.
-
error_type &assume_error() & noexcept
Narrow contract lvalue reference observer of the stored error. Constexpr propagating, never throws.
-
const error_type &assume_error() const & noexcept
Narrow contract const lvalue reference observer of the stored error. Constexpr propagating, never throws.
-
error_type &&assume_error() && noexcept
Narrow contract rvalue reference observer of the stored error. Constexpr propagating, never throws.
-
const error_type &&assume_error() const && noexcept
Narrow contract const rvalue reference observer of the stored error. Constexpr propagating, never throws.
-
error_type &error() &
Wide contract lvalue reference observer of the stored error. Constexpr propagating.
-
const error_type &error() const &
Wide contract const lvalue reference observer of the stored error. Constexpr propagating.
-
error_type &&error() &&
Wide contract rvalue reference observer of the stored error. Constexpr propagating.
-
const error_type &&error() const &&
Wide contract const rvalue reference observer of the stored error. Constexpr propagating.
-
exception_type &assume_exception() & noexcept
Narrow contract lvalue reference observer of the stored exception. Constexpr propagating, never throws.
-
const exception_type &assume_exception() const & noexcept
Narrow contract const lvalue reference observer of the stored exception. Constexpr propagating, never throws.
-
const exception_type &&assume_exception() const && noexcept
Narrow contract const rvalue reference observer of the stored exception. Constexpr propagating, never throws.
-
exception_type &&assume_exception() && noexcept
Narrow contract rvalue reference observer of the stored exception. Constexpr propagating, never throws.
-
exception_type &exception() &
Wide contract lvalue reference observer of the stored exception. Constexpr propagating.
-
const exception_type &exception() const &
Wide contract const lvalue reference observer of the stored exception. Constexpr propagating.
-
exception_type &&exception() &&
Wide contract rvalue reference observer of the stored exception. Constexpr propagating.
-
const exception_type &&exception() const &&
Wide contract const rvalue reference observer of the stored exception. Constexpr propagating.
-
exception_type failure() const noexcept
Synthesising observer of the stored exception or error. Available if the traits
is_error_code_available<T>
andis_exception_ptr_available<T>
are both true. Never throws. -
bool operator==(const basic_result<A, B, C> &) const
Returns true if this outcome compares equal to the other result. Constexpr and noexcept propagating.
-
bool operator==(const basic_outcome<A, B, C, D> &) const
Returns true if this outcome compares equal to the other outcome. Constexpr and noexcept propagating.
-
bool operator==(const success_type<A> &) const
Returns true if this result compares equal to the success type sugar. Constexpr and noexcept propagating.
-
bool operator==(const failure_type<A, B> &) const
Returns true if this outcome compares equal to the failure type sugar. Constexpr and noexcept propagating.
-
bool operator!=(const basic_result<A, B, C> &) const
Returns true if this outcome does not compare equal to the other result. Constexpr and noexcept propagating.
-
bool operator!=(const basic_outcome<A, B, C, D> &) const
Returns true if this outcome does not compare equal to the other outcome. Constexpr and noexcept propagating.
-
bool operator!=(const success_type<A> &) const
Returns true if this outcome does not compare equal to the success type sugar. Constexpr and noexcept propagating.
-
bool operator!=(const failure_type<A, B> &) const
Returns true if this outcome does not compare equal to the failure type sugar. Constexpr and noexcept propagating.
-
void swap(basic_outcome &)
Swap one basic_outcome with another, with the strong guarantee. Noexcept propagating.
-
failure_type<error_type, exception_type> as_failure() const &
Return the output from free function
failure()
containing a copy of any errored and/or excepted state. -
failure_type<error_type, exception_type> as_failure() &&
Return the output from free function
failure()
containing a move of any errored and/or excepted state.
-
-
basic_result<T, E, NoValuePolicy>
A sum type carrying either a successful
T
, or a disappointmentE
, withNoValuePolicy
specifying what to do if one tries to read state which isn’t there.-
basic_result() = delete
The default constructor (disabled).
-
basic_result(basic_result &&)
Move constructor. Constexpr, triviality and noexcept propagating.
-
basic_result(const basic_result &)
Copy constructor. Constexpr, triviality and noexcept propagating.
-
basic_result &operator=(basic_result &&)
Move assignment. Constexpr, triviality and noexcept propagating.
-
basic_result &operator=(const basic_result &)
Copy assignment. Constexpr, triviality and noexcept propagating.
-
~basic_result()
Destructor. Constexpr, triviality and noexcept propagating.
-
basic_result(Args...) = delete
Disabling catchall constructor used to give useful diagnostic error when trying to use non-inplace constructors when
predicate::constructors_enabled
is false. -
basic_result(X &&) = delete
Disabling implicit constructor used to give useful diagnostic error when trying to use implicit constructors when
predicate::implicit_constructors_enabled
is false. -
basic_result(R &&)
Implicit
value_type
constructor. Available ifpredicate::enable_value_converting_constructor<R>
is true. Constexpr, triviality and noexcept propagating. -
basic_result(S &&)
Implicit
error_type
constructor. Available ifpredicate::enable_error_converting_constructor<S>
is true. Constexpr, triviality and noexcept propagating. -
basic_result(ErrorCondEnum &&)
Implicit
error_type
fromErrorCondEnum
constructor. Available ifpredicate::enable_error_condition_converting_constructor<ErrorCondEnum>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(ValueOrError<T, E> &&)
Explicit converting constructor from
ValueOrError<T, E>
concept matching types. Available ifconvert::value_or_error<>
permits it. Constexpr, triviality and noexcept propagating. -
explicit basic_result(const basic_result<R, S, P> &)
Explicit converting copy constructor from compatible
basic_result
. Available ifpredicate::enable_compatible_conversion<R, S, P>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(basic_result<R, S, P> &&)
Explicit converting move constructor from compatible
basic_result
. Available ifpredicate::enable_compatible_conversion<R, S, P>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(const basic_result<R, S, P> &)
Explicit converting copy constructor from compatible
basic_result
. Available ifpredicate::enable_make_error_code_compatible_conversion<R, S, P>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(basic_result<R, S, P> &&)
Explicit converting move constructor from compatible
basic_result
. Available ifpredicate::enable_make_error_code_compatible_conversion<R, S, P>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(const basic_result<R, S, P> &)
Explicit converting copy constructor from compatible
basic_result
. Available ifpredicate::enable_make_exception_ptr_compatible_conversion<R, S, P>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(basic_result<R, S, P> &&)
Explicit converting move constructor from compatible
basic_result
. Available ifpredicate::enable_make_exception_ptr_compatible_conversion<R, S, P>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(in_place_type_t<value_type_if_enabled>, Args ...)
Explicit inplace value constructor. Available if
predicate::enable_inplace_value_constructor<Args ...>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(in_place_type_t<value_type_if_enabled>, std::initializer_list<U>, Args ...)
Explicit inplace value constructor. Available if
predicate::enable_inplace_value_constructor<std::initializer_list<U>, Args ...>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(in_place_type_t<error_type_if_enabled>, Args ...)
Explicit inplace error constructor. Available if
predicate::enable_inplace_error_constructor<Args ...>
is true. Constexpr, triviality and noexcept propagating. -
explicit basic_result(in_place_type_t<error_type_if_enabled>, std::initializer_list<U>, Args ...)
Explicit inplace error constructor. Available if
predicate::enable_inplace_error_constructor<std::initializer_list<U>, Args ...>
is true. Constexpr, triviality and noexcept propagating. -
basic_result(A1 &&, A2 &&, Args ...)
Implicit inplace value or error constructor. Available if
predicate::enable_inplace_value_error_constructor<A1, A2, Args ...>
is true. Constexpr, triviality and noexcept propagating. -
basic_result(const success_type<T> &)
Implicit value-from-success-type-sugar copy constructor. Available if
predicate::enable_compatible_conversion<T, void, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_result(success_type<T> &&)
Implicit value-from-success-type-sugar move constructor. Available if
predicate::enable_compatible_conversion<T, void, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_result(const failure_type<T> &)
Implicit error-from-failure-type-sugar copy constructor. Available if
predicate::enable_compatible_conversion<void, T, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_result(failure_type<T> &&)
Implicit error-from-failure-type-sugar move constructor. Available if
predicate::enable_compatible_conversion<void, T, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_result(const failure_type<T> &)
Implicit error-from-failure-type-sugar copy constructor. Available if
predicate::enable_make_error_code_compatible_conversion<void, T, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_result(failure_type<T> &&)
Implicit error-from-failure-type-sugar move constructor. Available if
predicate::enable_make_error_code_compatible_conversion<void, T, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_result(const failure_type<T> &)
Implicit error-from-failure-type-sugar copy constructor. Available if
predicate::enable_make_exception_ptr_compatible_conversion<void, T, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
basic_result(failure_type<T> &&)
Implicit error-from-failure-type-sugar move constructor. Available if
predicate::enable_make_exception_ptr_compatible_conversion<void, T, void>
is true, orT
isvoid
. Constexpr, triviality and noexcept propagating. -
explicit operator bool() const noexcept
Returns true if a value is present. Constexpr, never throws.
-
bool has_value() const noexcept
Returns true if a value is present. Constexpr, never throws.
-
bool has_error() const noexcept
Returns true if an error is present. Constexpr, never throws.
-
bool has_exception() const noexcept
Always returns false for
basic_result
. Constexpr, never throws. -
bool has_failure() const noexcept
Returns true if there is either an error or an exception. Constexpr, never throws.
-
bool has_lost_consistency() const noexcept
Returns true if a preceding swap involving this object failed to preserve the strong guarantee. Constexpr, never throws.
-
value_type &assume_value() & noexcept
Narrow contract lvalue reference observer of any value present. Constexpr propagating, never throws.
-
const value_type &assume_value() const & noexcept
Narrow contract const lvalue reference observer of any value present. Constexpr propagating, never throws.
-
value_type &&assume_value() && noexcept
Narrow contract rvalue reference observer of any value present. Constexpr propagating, never throws.
-
const value_type &&assume_value() const && noexcept
Narrow contract const rvalue reference observer of any value present. Constexpr propagating, never throws.
-
value_type &value() &
Wide contract lvalue reference observer of any value present. Constexpr propagating.
-
const value_type &value() const &
Wide contract const lvalue reference observer of any value present. Constexpr propagating.
-
value_type &&value() &&
Wide contract rvalue reference observer of any value present. Constexpr propagating.
-
const value_type &&value() const &&
Wide contract const rvalue reference observer of any value present. Constexpr propagating.
-
error_type &assume_error() & noexcept
Narrow contract lvalue reference observer of the stored error. Constexpr propagating, never throws.
-
const error_type &assume_error() const & noexcept
Narrow contract const lvalue reference observer of the stored error. Constexpr propagating, never throws.
-
error_type &&assume_error() && noexcept
Narrow contract rvalue reference observer of the stored error. Constexpr propagating, never throws.
-
const error_type &&assume_error() const && noexcept
Narrow contract const rvalue reference observer of the stored error. Constexpr propagating, never throws.
-
error_type &error() &
Wide contract lvalue reference observer of the stored error. Constexpr propagating.
-
const error_type &error() const &
Wide contract const lvalue reference observer of the stored error. Constexpr propagating.
-
error_type &&error() &&
Wide contract rvalue reference observer of the stored error. Constexpr propagating.
-
const error_type &&error() const &&
Wide contract const rvalue reference observer of the stored error. Constexpr propagating.
-
bool operator==(const basic_result<A, B, C> &) const
Returns true if this result compares equal to the other result. Constexpr and noexcept propagating.
-
bool operator==(const success_type<A> &) const
Returns true if this result compares equal to the success type sugar. Constexpr and noexcept propagating.
-
bool operator==(const failure_type<A, void> &) const
Returns true if this result compares equal to the failure type sugar. Constexpr and noexcept propagating.
-
bool operator!=(const basic_result<A, B, C> &) const
Returns true if this result does not compare equal to the other result. Constexpr and noexcept propagating.
-
bool operator!=(const success_type<A> &) const
Returns true if this result does not compare equal to the success type sugar. Constexpr and noexcept propagating.
-
bool operator!=(const failure_type<A, void> &) const
Returns true if this result does not compare equal to the failure type sugar. Constexpr and noexcept propagating.
-
void swap(basic_result &)
Swap one basic_result with another, with the strong guarantee. Noexcept propagating.
-
auto as_failure() const &
Return the output from free function
failure()
containing a copy of any errored state. -
auto as_failure() &&
Return the output from free function
failure()
containing a move of any errored state.
-
-
bad_outcome_access
Exception type publicly inheriting from
std::logic_error
indicating an incorrect observation of value or error or exception occurred. -
bad_result_access_with<EC>
Exception type publicly inheriting from
bad_result_access
indicating an incorrect observation of value occurred, supplying the error value. -
bad_result_access
Exception type publicly inheriting from
std::logic_error
indicating an incorrect observation of value or error occurred. -
eager<T>/atomic_eager<T>
An eagerly evaluated coroutine awaitable with Outcome customisation.
-
failure_type<EC, EP = void>
Type sugar for constructing an unsuccessful result or outcome.
-
in_place_type_t<T>
Either
std::in_place_type_t<T>
or a local emulation, depending on theBOOST_OUTCOME_USE_STD_IN_PLACE_TYPE
macro. -
lazy<T>/atomic_lazy<T>
A lazily evaluated coroutine awaitable with Outcome customisation.
-
success_type<T>
Type sugar for constructing a successful result or outcome.