exception_ptr rethrow (Outcome)

Header file outcome_exception_ptr_rethrow.hpp

#include "result_exception_ptr_rethrow.hpp"

namespace outcome_v2_xxx
{
    namespace policy
    {
        template <class T, class EC, class E>
        struct exception_ptr_rethrow;
    }
}

Struct outcome_v2_xxx::policy::exception_ptr_rethrow

template <class T, class EC, class E>
struct exception_ptr_rethrow
{
    template <class Impl>
    static constexpr void wide_value_check(Impl&& self);

    template <class Impl>
    static constexpr void wide_error_check(Impl&& self);

    template <class Impl>
    static constexpr void wide_exception_check(Impl&& self);

    template <class Impl>
    static constexpr void narrow_value_check(Impl&& self) noexcept;

    template <class Impl>
    static constexpr void narrow_error_check(Impl&& self) noexcept;

    template <class Impl>
    static constexpr void narrow_exception_check(Impl&& self) noexcept;
};

Policy interpreting EC or E as a type for which trait::has_exception_ptr_v<EC|E> is true.

Any wide attempt to access the successful state where there is none causes: std::rethrow_exception(policy::exception_ptr(.error()|.exception())) appropriately.

Function narrow_value_check

template <class Impl>
static constexpr void narrow_value_check(Impl&& self) noexcept;

Performs a narrow check of state, used in the assume_value() functions.

Effects: None.


Function narrow_error_check

template <class Impl>
static constexpr void narrow_error_check(Impl&& self) noexcept;

Performs a narrow check of state, used in the assume_error() functions

Effects: None.


Function narrow_exception_check

template <class Impl>
static constexpr void narrow_exception_check(Impl&& self) noexcept;

Performs a narrow check of state, used in the assume_exception() functions

Effects: None.


Function wide_value_check

template <class Impl>
static constexpr void wide_value_check(Impl&& self);

Performs a wide check of state, used in the value() functions

Effects: If outcome does not have a value, if it has an exception it rethrows that exception via std::rethrow_exception(), if it has an error it rethrows that error via std::rethrow_exception(), else it throws bad_outcome_access.


Function wide_error_check

template <class Impl>
static constexpr void wide_error_check(Impl&& self);

Performs a wide check of state, used in the error() functions

Effects: If outcome does not have an error, it throws bad_outcome_access.


Function wide_exception_check

template <class Impl>
static constexpr void wide_exception_check(Impl&& self);

Performs a wide check of state, used in the exception() functions

Effects: If result does not have an exception, it throws bad_outcome_access.