Types

  1. basic_outcome<T, EC, EP, NoValuePolicy>

    A type carrying one of (i) a successful T (ii) a disappointment EC (iii) a failure EP (iv) both a disappointment EC and a failure EP, with NoValuePolicy specifying what to do if one tries to read state which isn’t there.

    1. basic_outcome() = delete

      The default constructor (disabled).

    2. basic_outcome(basic_outcome &&)

      Move constructor. Constexpr, triviality and noexcept propagating.

    3. basic_outcome(const basic_outcome &)

      Copy constructor. Constexpr, triviality and noexcept propagating.

    4. basic_outcome &operator=(basic_outcome &&)

      Move assignment. Constexpr, triviality and noexcept propagating.

    5. basic_outcome &operator=(const basic_outcome &)

      Copy assignment. Constexpr, triviality and noexcept propagating.

    6. ~basic_outcome()

      Destructor. Constexpr, triviality and noexcept propagating.

    7. 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.

    8. 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.

    9. basic_outcome(R &&)

      Implicit value_type constructor. Available if predicate::enable_value_converting_constructor<R> is true. Constexpr, triviality and noexcept propagating.

    10. basic_outcome(S &&)

      Implicit error_type constructor. Available if predicate::enable_error_converting_constructor<S> is true. Constexpr, triviality and noexcept propagating.

    11. basic_outcome(ErrorCondEnum &&)

      Implicit error_type from ErrorCondEnum constructor. Available if predicate::enable_error_condition_converting_constructor<ErrorCondEnum> is true. Constexpr, triviality and noexcept propagating.

    12. basic_outcome(P &&)

      Implicit exception_type constructor. Available if predicate::enable_exception_converting_constructor<P> is true. Constexpr, triviality and noexcept propagating.

    13. basic_outcome(S &&, P &&)

      Implicit error_type + exception_type constructor. Available if predicate::enable_error_exception_converting_constructor<S, P> is true. Constexpr, triviality and noexcept propagating.

    14. explicit basic_outcome(concepts::value_or_error<T, E> &&)

      Explicit converting constructor from concepts::value_or_error<T, E> concept matching types. Available if convert::value_or_error<> permits it. Constexpr, triviality and noexcept propagating.

    15. explicit basic_outcome(const basic_outcome<A, B, C, D> &)

      Explicit converting copy constructor from compatible basic_outcome. Available if predicate::enable_compatible_conversion<A, B, C, D> is true. Constexpr, triviality and noexcept propagating.

    16. explicit basic_outcome(basic_outcome<A, B, C, D> &&)

      Explicit converting move constructor from compatible basic_outcome. Available if predicate::enable_compatible_conversion<A, B, C, D> is true. Constexpr, triviality and noexcept propagating.

    17. explicit basic_outcome(const basic_result<A, B, C> &)

      Explicit converting copy constructor from compatible basic_result. Available if predicate::enable_compatible_conversion<A, B, void, C> is true. Constexpr, triviality and noexcept propagating.

    18. explicit basic_outcome(basic_result<A, B, C> &&)

      Explicit converting move constructor from compatible basic_result. Available if predicate::enable_compatible_conversion<A, B, void, C> is true. Constexpr, triviality and noexcept propagating.

    19. explicit basic_outcome(const basic_result<A, B, C> &)

      Explicit converting copy constructor from compatible basic_result. Available if predicate::enable_make_error_code_compatible_conversion<A, B, void, C> is true. Constexpr, triviality and noexcept propagating.

    20. explicit basic_outcome(basic_result<A, B, C> &&)

      Explicit converting move constructor from compatible basic_result. Available if predicate::enable_make_error_code_compatible_conversion<A, B, void, C> is true. Constexpr, triviality and noexcept propagating.

    21. 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.

    22. 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.

    23. 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.

    24. 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.

    25. 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.

    26. 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.

    27. 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.

    28. 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, or T is void. Constexpr, triviality and noexcept propagating.

    29. basic_outcome(success_type<T> &&)

      Implicit value-from-success-type-sugar move constructor. Available if predicate::enable_compatible_conversion<T, void, void> is true, or T is void. Constexpr, triviality and noexcept propagating.

    30. 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.

    31. 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.

    32. 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.

    33. 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.

    34. 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.

    35. 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.

    36. 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.

    37. 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.

    38. explicit operator bool() const noexcept

      Returns true if a value is present. Constexpr, never throws.

    39. bool has_value() const noexcept

      Returns true if a value is present. Constexpr, never throws.

    40. bool has_error() const noexcept

      Returns true if an error is present. Constexpr, never throws.

    41. bool has_exception() const noexcept

      Returns true if an exception is present. Constexpr, never throws.

    42. bool has_failure() const noexcept

      Returns true if there is either an error or an exception. Constexpr, never throws.

    43. value_type &assume_value() & noexcept

      Narrow contract lvalue reference observer of any value present. Constexpr propagating, never throws.

    44. const value_type &assume_value() const & noexcept

      Narrow contract const lvalue reference observer of any value present. Constexpr propagating, never throws.

    45. value_type &&assume_value() && noexcept

      Narrow contract rvalue reference observer of any value present. Constexpr propagating, never throws.

    46. const value_type &&assume_value() const && noexcept

      Narrow contract const rvalue reference observer of any value present. Constexpr propagating, never throws.

    47. value_type &value() &

      Wide contract lvalue reference observer of any value present. Constexpr propagating.

    48. const value_type &value() const &

      Wide contract const lvalue reference observer of any value present. Constexpr propagating.

    49. value_type &&value() &&

      Wide contract rvalue reference observer of any value present. Constexpr propagating.

    50. const value_type &&value() const &&

      Wide contract const rvalue reference observer of any value present. Constexpr propagating.

    51. error_type &assume_error() & noexcept

      Narrow contract lvalue reference observer of the stored error. Constexpr propagating, never throws.

    52. const error_type &assume_error() const & noexcept

      Narrow contract const lvalue reference observer of the stored error. Constexpr propagating, never throws.

    53. error_type &&assume_error() && noexcept

      Narrow contract rvalue reference observer of the stored error. Constexpr propagating, never throws.

    54. const error_type &&assume_error() const && noexcept

      Narrow contract const rvalue reference observer of the stored error. Constexpr propagating, never throws.

    55. error_type &error() &

      Wide contract lvalue reference observer of the stored error. Constexpr propagating.

    56. const error_type &error() const &

      Wide contract const lvalue reference observer of the stored error. Constexpr propagating.

    57. error_type &&error() &&

      Wide contract rvalue reference observer of the stored error. Constexpr propagating.

    58. const error_type &&error() const &&

      Wide contract const rvalue reference observer of the stored error. Constexpr propagating.

    59. exception_type &assume_exception() & noexcept

      Narrow contract lvalue reference observer of the stored exception. Constexpr propagating, never throws.

    60. const exception_type &assume_exception() const & noexcept

      Narrow contract const lvalue reference observer of the stored exception. Constexpr propagating, never throws.

    61. const exception_type &&assume_exception() const && noexcept

      Narrow contract const rvalue reference observer of the stored exception. Constexpr propagating, never throws.

    62. exception_type &&assume_exception() && noexcept

      Narrow contract rvalue reference observer of the stored exception. Constexpr propagating, never throws.

    63. exception_type &exception() &

      Wide contract lvalue reference observer of the stored exception. Constexpr propagating.

    64. const exception_type &exception() const &

      Wide contract const lvalue reference observer of the stored exception. Constexpr propagating.

    65. exception_type &&exception() &&

      Wide contract rvalue reference observer of the stored exception. Constexpr propagating.

    66. const exception_type &&exception() const &&

      Wide contract const rvalue reference observer of the stored exception. Constexpr propagating.

    67. exception_type failure() const noexcept

      Synthesising observer of the stored exception or error. Available if the traits is_error_code_available<T> and is_exception_ptr_available<T> are both true. Never throws.

    68. bool operator==(const basic_result<A, B, C> &) const

      Returns true if this outcome compares equal to the other result. Constexpr and noexcept propagating.

    69. 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.

    70. bool operator==(const success_type<A> &) const

      Returns true if this result compares equal to the success type sugar. Constexpr and noexcept propagating.

    71. bool operator==(const failure_type<A, B> &) const

      Returns true if this outcome compares equal to the failure type sugar. Constexpr and noexcept propagating.

    72. 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.

    73. 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.

    74. 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.

    75. 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.

    76. void swap(basic_outcome &)

      Swap one basic_outcome with another, with the strong guarantee. Noexcept propagating.

    77. 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.

    78. 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.

  2. basic_result<T, E, NoValuePolicy>

    A sum type carrying either a successful T, or a disappointment E, with NoValuePolicy specifying what to do if one tries to read state which isn’t there.

    1. basic_result() = delete

      The default constructor (disabled).

    2. basic_result(basic_result &&)

      Move constructor. Constexpr, triviality and noexcept propagating.

    3. basic_result(const basic_result &)

      Copy constructor. Constexpr, triviality and noexcept propagating.

    4. basic_result &operator=(basic_result &&)

      Move assignment. Constexpr, triviality and noexcept propagating.

    5. basic_result &operator=(const basic_result &)

      Copy assignment. Constexpr, triviality and noexcept propagating.

    6. ~basic_result()

      Destructor. Constexpr, triviality and noexcept propagating.

    7. 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.

    8. 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.

    9. basic_result(R &&)

      Implicit value_type constructor. Available if predicate::enable_value_converting_constructor<R> is true. Constexpr, triviality and noexcept propagating.

    10. basic_result(S &&)

      Implicit error_type constructor. Available if predicate::enable_error_converting_constructor<S> is true. Constexpr, triviality and noexcept propagating.

    11. basic_result(ErrorCondEnum &&)

      Implicit error_type from ErrorCondEnum constructor. Available if predicate::enable_error_condition_converting_constructor<ErrorCondEnum> is true. Constexpr, triviality and noexcept propagating.

    12. explicit basic_result(concepts::value_or_error<T, E> &&)

      Explicit converting constructor from concepts::value_or_error<T, E> concept matching types. Available if convert::value_or_error<> permits it. Constexpr, triviality and noexcept propagating.

    13. explicit basic_result(const basic_result<R, S, P> &)

      Explicit converting copy constructor from compatible basic_result. Available if predicate::enable_compatible_conversion<R, S, P> is true. Constexpr, triviality and noexcept propagating.

    14. explicit basic_result(basic_result<R, S, P> &&)

      Explicit converting move constructor from compatible basic_result. Available if predicate::enable_compatible_conversion<R, S, P> is true. Constexpr, triviality and noexcept propagating.

    15. explicit basic_result(const basic_result<R, S, P> &)

      Explicit converting copy constructor from compatible basic_result. Available if predicate::enable_make_error_code_compatible_conversion<R, S, P> is true. Constexpr, triviality and noexcept propagating.

    16. explicit basic_result(basic_result<R, S, P> &&)

      Explicit converting move constructor from compatible basic_result. Available if predicate::enable_make_error_code_compatible_conversion<R, S, P> is true. Constexpr, triviality and noexcept propagating.

    17. explicit basic_result(const basic_result<R, S, P> &)

      Explicit converting copy constructor from compatible basic_result. Available if predicate::enable_make_exception_ptr_compatible_conversion<R, S, P> is true. Constexpr, triviality and noexcept propagating.

    18. explicit basic_result(basic_result<R, S, P> &&)

      Explicit converting move constructor from compatible basic_result. Available if predicate::enable_make_exception_ptr_compatible_conversion<R, S, P> is true. Constexpr, triviality and noexcept propagating.

    19. 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.

    20. 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.

    21. 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.

    22. 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.

    23. 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.

    24. 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, or T is void. Constexpr, triviality and noexcept propagating.

    25. basic_result(success_type<T> &&)

      Implicit value-from-success-type-sugar move constructor. Available if predicate::enable_compatible_conversion<T, void, void> is true, or T is void. Constexpr, triviality and noexcept propagating.

    26. 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, or T is void. Constexpr, triviality and noexcept propagating.

    27. basic_result(failure_type<T> &&)

      Implicit error-from-failure-type-sugar move constructor. Available if predicate::enable_compatible_conversion<void, T, void> is true, or T is void. Constexpr, triviality and noexcept propagating.

    28. 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, or T is void. Constexpr, triviality and noexcept propagating.

    29. 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, or T is void. Constexpr, triviality and noexcept propagating.

    30. 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, or T is void. Constexpr, triviality and noexcept propagating.

    31. 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, or T is void. Constexpr, triviality and noexcept propagating.

    32. explicit operator bool() const noexcept

      Returns true if a value is present. Constexpr, never throws.

    33. bool has_value() const noexcept

      Returns true if a value is present. Constexpr, never throws.

    34. bool has_error() const noexcept

      Returns true if an error is present. Constexpr, never throws.

    35. bool has_exception() const noexcept

      Always returns false for basic_result. Constexpr, never throws.

    36. bool has_failure() const noexcept

      Returns true if there is either an error or an exception. Constexpr, never throws.

    37. bool has_lost_consistency() const noexcept

      Returns true if a preceding swap involving this object failed to preserve the strong guarantee. Constexpr, never throws.

    38. value_type &assume_value() & noexcept

      Narrow contract lvalue reference observer of any value present. Constexpr propagating, never throws.

    39. const value_type &assume_value() const & noexcept

      Narrow contract const lvalue reference observer of any value present. Constexpr propagating, never throws.

    40. value_type &&assume_value() && noexcept

      Narrow contract rvalue reference observer of any value present. Constexpr propagating, never throws.

    41. const value_type &&assume_value() const && noexcept

      Narrow contract const rvalue reference observer of any value present. Constexpr propagating, never throws.

    42. value_type &value() &

      Wide contract lvalue reference observer of any value present. Constexpr propagating.

    43. const value_type &value() const &

      Wide contract const lvalue reference observer of any value present. Constexpr propagating.

    44. value_type &&value() &&

      Wide contract rvalue reference observer of any value present. Constexpr propagating.

    45. const value_type &&value() const &&

      Wide contract const rvalue reference observer of any value present. Constexpr propagating.

    46. error_type &assume_error() & noexcept

      Narrow contract lvalue reference observer of the stored error. Constexpr propagating, never throws.

    47. const error_type &assume_error() const & noexcept

      Narrow contract const lvalue reference observer of the stored error. Constexpr propagating, never throws.

    48. error_type &&assume_error() && noexcept

      Narrow contract rvalue reference observer of the stored error. Constexpr propagating, never throws.

    49. const error_type &&assume_error() const && noexcept

      Narrow contract const rvalue reference observer of the stored error. Constexpr propagating, never throws.

    50. error_type &error() &

      Wide contract lvalue reference observer of the stored error. Constexpr propagating.

    51. const error_type &error() const &

      Wide contract const lvalue reference observer of the stored error. Constexpr propagating.

    52. error_type &&error() &&

      Wide contract rvalue reference observer of the stored error. Constexpr propagating.

    53. const error_type &&error() const &&

      Wide contract const rvalue reference observer of the stored error. Constexpr propagating.

    54. bool operator==(const basic_result<A, B, C> &) const

      Returns true if this result compares equal to the other result. Constexpr and noexcept propagating.

    55. bool operator==(const success_type<A> &) const

      Returns true if this result compares equal to the success type sugar. Constexpr and noexcept propagating.

    56. bool operator==(const failure_type<A, void> &) const

      Returns true if this result compares equal to the failure type sugar. Constexpr and noexcept propagating.

    57. 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.

    58. 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.

    59. 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.

    60. void swap(basic_result &)

      Swap one basic_result with another, with the strong guarantee. Noexcept propagating.

    61. auto as_failure() const &

      Return the output from free function failure() containing a copy of any errored state.

    62. auto as_failure() &&

      Return the output from free function failure() containing a move of any errored state.

  3. bad_outcome_access

    Exception type publicly inheriting from std::logic_error indicating an incorrect observation of value or error or exception occurred.

  4. bad_result_access_with<EC>

    Exception type publicly inheriting from bad_result_access indicating an incorrect observation of value occurred, supplying the error value.

  5. bad_result_access

    Exception type publicly inheriting from std::logic_error indicating an incorrect observation of value or error occurred.

  6. eager<T, Executor = void>/atomic_eager<T, Executor = void>

    An eagerly evaluated coroutine awaitable with Outcome customisation.

  7. failure_type<EC, EP = void>

    Type sugar for constructing an unsuccessful result or outcome.

  8. generator<T, Executor = void>

    A lazily evaluated coroutine generator with Outcome customisation.

  9. in_place_type_t<T>

    Either std::in_place_type_t<T> or a local emulation, depending on the OUTCOME_USE_STD_IN_PLACE_TYPE macro.

  10. lazy<T, Executor = void>/atomic_lazy<T, Executor = void>

    A lazily evaluated coroutine awaitable with Outcome customisation.

  11. success_type<T>

    Type sugar for constructing a successful result or outcome.