Interoperation

Header file convert.hpp

namespace outcome_v2_xxx
{
    namespace convert
    {
        template <class U>static constexpr bool ValueOrNone = detail::ValueOrNone<U>;

        template <class U>static constexpr bool ValueOrError = detail::ValueOrError<U>;

        template <class T, class U>
        struct value_or_error;
    }
}

Struct outcome_v2_xxx::convert::value_or_error

template <class T, class U>
struct value_or_error
{
    static constexpr bool const enable_result_inputs;

    static constexpr bool const enable_outcome_inputs;

    template <class X, typename = std::enable_if_t<std::is_same<U,std::decay_t<X>>::value&&ValueOrError<U>&&(std::is_void<typename std::decay_t<X>::value_type>::value||outcome_v2_xxx::detail::is_explicitly_constructible<typename T::value_type,typename std::decay_t<X>::value_type>)&&(std::is_void<typename std::decay_t<X>::error_type>::value||outcome_v2_xxx::detail::is_explicitly_constructible<typename T::error_type,typename std::decay_t<X>::error_type>)>>
    constexpr T operator()(X&& v);
};

Default converter for types matching the ValueOrError concept.

You can partially or fully specialise this converter for your own user defined types by injecting specialisations into the convert namespace.

Variable outcome_v2_xxx::convert::value_or_error::enable_result_inputs

static constexpr bool const enable_result_inputs;

False to indicate that this converter wants result/outcome to reject all other result


Variable outcome_v2_xxx::convert::value_or_error::enable_outcome_inputs

static constexpr bool const enable_outcome_inputs;

False to indicate that this converter wants outcome to reject all other outcome


Function outcome_v2_xxx::convert::value_or_error::operator()

template <class X, typename = std::enable_if_t<std::is_same<U,std::decay_t<X>>::value&&ValueOrError<U>&&(std::is_void<typename std::decay_t<X>::value_type>::value||outcome_v2_xxx::detail::is_explicitly_constructible<typename T::value_type,typename std::decay_t<X>::value_type>)&&(std::is_void<typename std::decay_t<X>::error_type>::value||outcome_v2_xxx::detail::is_explicitly_constructible<typename T::error_type,typename std::decay_t<X>::error_type>)>>
constexpr T operator()(X&& v);

Default converter for types matching the ValueOrError concept.

Requires: std::decay_t<X> to be the same type as U; ValueOrError<U> to be true, U’s value_type be constructible into T’s value_type and U’s error_type be constructible into T’s error_type.