Header file errored_status_code.hpp

#include "generic_code.hpp"

#include "status_code_ptr.hpp"

namespace system_error2
{
    template <class DomainType>
    class errored_status_code;

    namespace traits
    {
        template <class DomainType>
        struct is_move_relocating<errored_status_code<DomainType>;
    }

    template <class ErasedType>
    class errored_status_code<erased<ErasedType>;

    namespace traits
    {
        template <class ErasedType>
        struct is_move_relocating<errored_status_code<erased<ErasedType>>>;
    }

    template <class DomainType1, class DomainType2>
    bool operator==(errored_status_code<DomainType1> const& a, errored_status_code<DomainType2> const& b) noexcept;

    template <class DomainType1, class DomainType2>
    bool operator==(status_code<DomainType1> const& a, errored_status_code<DomainType2> const& b) noexcept;

    template <class DomainType1, class DomainType2>
    bool operator==(errored_status_code<DomainType1> const& a, status_code<DomainType2> const& b) noexcept;

    template <class DomainType1, class DomainType2>
    bool operator!=(errored_status_code<DomainType1> const& a, errored_status_code<DomainType2> const& b) noexcept;

    template <class DomainType1, class DomainType2>
    bool operator!=(status_code<DomainType1> const& a, errored_status_code<DomainType2> const& b) noexcept;

    template <class DomainType1, class DomainType2>
    bool operator!=(errored_status_code<DomainType1> const& a, status_code<DomainType2> const& b) noexcept;

    template <class DomainType1>
    bool operator==(errored_status_code<DomainType1> const& a, system_error2::errc b) noexcept;

    template <class DomainType1>
    bool operator==(system_error2::errc a, errored_status_code<DomainType1> const& b) noexcept;

    template <class DomainType1>
    bool operator!=(errored_status_code<DomainType1> const& a, system_error2::errc b) noexcept;

    template <class DomainType1>
    bool operator!=(system_error2::errc a, errored_status_code<DomainType1> const& b) noexcept;
}

Class system_error2::errored_status_code

template <class DomainType>
class errored_status_code
: public status_code<DomainType>
{
public:
    errored_status_code() = default;

    errored_status_code(const errored_status_code<DomainType>&) = default;

    errored_status_code(errored_status_code<DomainType>&&) = default;

    errored_status_code<DomainType>& operator=(const errored_status_code<DomainType>&) = default;

    errored_status_code<DomainType>& operator=(errored_status_code<DomainType>&&) = default;

    ~errored_status_code() = default;

    explicit errored_status_code('hidden' const& o) noexcept(std::is_nothrow_copy_constructible<_base>::value);

    explicit errored_status_code('hidden'&& o) noexcept(std::is_nothrow_move_constructible<_base>::value);

    template <class T, class ... Args, class MakeStatusCodeOutType = decltype(make_status_code(std::declval<T>(),std::declval<Args>()...)), typename std::enable_if<!std::is_same<typename std::decay<T>::type, errored_status_code<DomainType> >::value && is_status_code<MakeStatusCodeOutType>::value && std::is_constructible<errored_status_code<DomainType>, MakeStatusCodeOutType>::value, bool>::type = true>
    errored_status_code(T&& v, Args &&... args) noexcept(noexcept(make_status_code(std::declval<T>(), std::declval<Args>()...)));

    template <class ... Args>
    explicit errored_status_code(system_error2::in_place_t _, Args &&... args) noexcept(std::is_nothrow_constructible<value_type, Args && ...>::value);

    template <class T, class ... Args>
    explicit errored_status_code(system_error2::in_place_t _, std::initializer_list<T> il, Args &&... args) noexcept(std::is_nothrow_constructible<value_type, std::initializer_list<T>, Args && ...>::value);

    explicit errored_status_code(const system_error2::errored_status_code::value_type& v) noexcept(std::is_nothrow_copy_constructible<value_type>::value);

    explicit errored_status_code(system_error2::errored_status_code::value_type&& v) noexcept(std::is_nothrow_move_constructible<value_type>::value);

    template <class ErasedType, typename std::enable_if<detail::type_erasure_is_safe<ErasedType, value_type>::value, bool>::type = true>
    explicit errored_status_code(status_code<erased<ErasedType>> const& v) noexcept(std::is_nothrow_copy_constructible<value_type>::value);

    constexpr const system_error2::errored_status_code::value_type& value() const & noexcept;
};

A status_code which is always a failure. The closest equivalent to std::error_code, except it cannot be modified, and is templated.

Differences from status_code:

Constructor system_error2::errored_status_code::errored_status_code

errored_status_code() = default;

Default constructor.


Constructor system_error2::errored_status_code::errored_status_code

errored_status_code(const errored_status_code<DomainType>&) = default;

Copy constructor.


Constructor system_error2::errored_status_code::errored_status_code

errored_status_code(errored_status_code<DomainType>&&) = default;

Move constructor.


Function system_error2::errored_status_code::operator=

errored_status_code<DomainType>& operator=(const errored_status_code<DomainType>&) = default;

Copy assignment.


Function system_error2::errored_status_code::operator=

errored_status_code<DomainType>& operator=(errored_status_code<DomainType>&&) = default;

Move assignment.


Constructor system_error2::errored_status_code::errored_status_code

explicit errored_status_code('hidden' const& o) noexcept(std::is_nothrow_copy_constructible<_base>::value);

Explicitly construct from any similarly erased status code


Constructor system_error2::errored_status_code::errored_status_code

explicit errored_status_code('hidden'&& o) noexcept(std::is_nothrow_move_constructible<_base>::value);

Explicitly construct from any similarly erased status code


Constructor system_error2::errored_status_code::errored_status_code

template <class T, class ... Args, class MakeStatusCodeOutType = decltype(make_status_code(std::declval<T>(),std::declval<Args>()...)), typename std::enable_if<!std::is_same<typename std::decay<T>::type, errored_status_code<DomainType> >::value && is_status_code<MakeStatusCodeOutType>::value && std::is_constructible<errored_status_code<DomainType>, MakeStatusCodeOutType>::value, bool>::type = true>
errored_status_code(T&& v, Args &&... args) noexcept(noexcept(make_status_code(std::declval<T>(), std::declval<Args>()...)));

Implicit construction from any type where an ADL discovered make_status_code(T, Args ...) returns a status_code.


Constructor system_error2::errored_status_code::errored_status_code

template <class ... Args>
explicit errored_status_code(system_error2::in_place_t _, Args &&... args) noexcept(std::is_nothrow_constructible<value_type, Args && ...>::value);

Explicit in-place construction.


Constructor system_error2::errored_status_code::errored_status_code

template <class T, class ... Args>
explicit errored_status_code(system_error2::in_place_t _, std::initializer_list<T> il, Args &&... args) noexcept(std::is_nothrow_constructible<value_type, std::initializer_list<T>, Args && ...>::value);

Explicit in-place construction from initialiser list.


Constructor system_error2::errored_status_code::errored_status_code

explicit errored_status_code(const system_error2::errored_status_code::value_type& v) noexcept(std::is_nothrow_copy_constructible<value_type>::value);

Explicit copy construction from a value_type.


Constructor system_error2::errored_status_code::errored_status_code

explicit errored_status_code(system_error2::errored_status_code::value_type&& v) noexcept(std::is_nothrow_move_constructible<value_type>::value);

Explicit move construction from a value_type.


Constructor system_error2::errored_status_code::errored_status_code

template <class ErasedType, typename std::enable_if<detail::type_erasure_is_safe<ErasedType, value_type>::value, bool>::type = true>
explicit errored_status_code(status_code<erased<ErasedType>> const& v) noexcept(std::is_nothrow_copy_constructible<value_type>::value);

Explicit construction from an erased status code. Available only if value_type is trivially destructible and sizeof(status_code) <= sizeof(status_code<erased<>>).

Does not check if domains are equal.


Function system_error2::errored_status_code::value

constexpr const system_error2::errored_status_code::value_type& value() const & noexcept;

Return a const reference to the value_type.



Function system_error2::operator==

template <class DomainType1, class DomainType2>
bool operator==(errored_status_code<DomainType1> const& a, errored_status_code<DomainType2> const& b) noexcept;

True if the status code’s are semantically equal via equivalent().


Function system_error2::operator==

template <class DomainType1, class DomainType2>
bool operator==(status_code<DomainType1> const& a, errored_status_code<DomainType2> const& b) noexcept;

True if the status code’s are semantically equal via equivalent().


Function system_error2::operator==

template <class DomainType1, class DomainType2>
bool operator==(errored_status_code<DomainType1> const& a, status_code<DomainType2> const& b) noexcept;

True if the status code’s are semantically equal via equivalent().


Function system_error2::operator!=

template <class DomainType1, class DomainType2>
bool operator!=(errored_status_code<DomainType1> const& a, errored_status_code<DomainType2> const& b) noexcept;

True if the status code’s are not semantically equal via equivalent().


Function system_error2::operator!=

template <class DomainType1, class DomainType2>
bool operator!=(status_code<DomainType1> const& a, errored_status_code<DomainType2> const& b) noexcept;

True if the status code’s are not semantically equal via equivalent().


Function system_error2::operator!=

template <class DomainType1, class DomainType2>
bool operator!=(errored_status_code<DomainType1> const& a, status_code<DomainType2> const& b) noexcept;

True if the status code’s are not semantically equal via equivalent().


Function system_error2::operator==

template <class DomainType1>
bool operator==(errored_status_code<DomainType1> const& a, system_error2::errc b) noexcept;

True if the status code’s are semantically equal via equivalent() to the generic code.


Function system_error2::operator==

template <class DomainType1>
bool operator==(system_error2::errc a, errored_status_code<DomainType1> const& b) noexcept;

True if the status code’s are semantically equal via equivalent() to the generic code.


Function system_error2::operator!=

template <class DomainType1>
bool operator!=(errored_status_code<DomainType1> const& a, system_error2::errc b) noexcept;

True if the status code’s are not semantically equal via equivalent() to the generic code.


Function system_error2::operator!=

template <class DomainType1>
bool operator!=(system_error2::errc a, errored_status_code<DomainType1> const& b) noexcept;

True if the status code’s are not semantically equal via equivalent() to the generic code.