Header file result.hpp

#include "error.hpp"

namespace system_error2
{
    template <class T>inline constexpr std::in_place_type_t<T>in_place_type{};

    template <class T>
    struct is_result;

    template <class T>
    struct is_result<result<T>;

    class bad_result_access;

    template <class T>
    class result;

    template <class T, class U, typename = decltype(std::declval<T>()==std::declval<U>())>
    constexpr bool operator==(result<T> const& a, result<U> const& b) noexcept;

    template <class T, class U, typename = decltype(std::declval<T>()!=std::declval<U>())>
    constexpr bool operator!=(result<T> const& a, result<U> const& b) noexcept;
}

Struct system_error2::is_result

template <class T>
struct is_result
{
};

A trait for detecting result types


Class system_error2::bad_result_access

class bad_result_access
: public std::exception
{
public:
    bad_result_access() = default;

    virtual char const* what() const noexcept;
};

Exception type representing the failure to retrieve an error.

Function system_error2::bad_result_access::what

virtual char const* what() const noexcept;

Return an explanatory string



Class system_error2::result

template <class T>
class result
{
};

(error while parsing comment text: unkown command \class)


Function system_error2::operator==

template <class T, class U, typename = decltype(std::declval<T>()==std::declval<U>())>
constexpr bool operator==(result<T> const& a, result<U> const& b) noexcept;

True if the two results compare equal.


Function system_error2::operator!=

template <class T, class U, typename = decltype(std::declval<T>()!=std::declval<U>())>
constexpr bool operator!=(result<T> const& a, result<U> const& b) noexcept;

True if the two results compare unequal.