29#ifndef _GLIBCXX_SYSTEM_ERROR
30#define _GLIBCXX_SYSTEM_ERROR 1
33#pragma GCC system_header
38#if __cplusplus < 201103L
46#if __cplusplus > 201703L
50namespace std _GLIBCXX_VISIBILITY(default)
52_GLIBCXX_BEGIN_NAMESPACE_VERSION
59 class error_condition;
63 template<
typename _Tp>
67 template<
typename _Tp>
74#if __cplusplus > 201402L
75 template <
typename _Tp>
76 inline constexpr bool is_error_code_enum_v =
77 is_error_code_enum<_Tp>::value;
78 template <
typename _Tp>
79 inline constexpr bool is_error_condition_enum_v =
80 is_error_condition_enum<_Tp>::value;
84_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
126#if _GLIBCXX_USE_CXX11_ABI
128 _GLIBCXX_DEFAULT_ABI_TAG
130 _M_message(
int)
const;
134 _GLIBCXX_DEFAULT_ABI_TAG
136 message(
int)
const = 0;
139 message(
int)
const = 0;
143 _M_message(
int)
const;
163 {
return this == &__other; }
166#if __cpp_lib_three_way_comparison
170 {
return std::compare_three_way()(
this, &__rhs); }
177 operator!=(
const error_category& __other)
const noexcept
178 {
return this != &__other; }
185 [[__nodiscard__, __gnu__::__const__]]
186 const error_category&
190 [[__nodiscard__, __gnu__::__const__]]
196_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
227 template<
typename _ErrorCodeEnum>
229 = __enable_if_t<is_error_code_enum<_ErrorCodeEnum>::value>;
236 : _M_value(__v), _M_cat(&__cat) { }
239 template<
typename _ErrorCodeEnum,
240 typename = _Check<_ErrorCodeEnum>>
243 using __adl_only::make_error_code;
264 value() const noexcept {
return _M_value; }
276 _GLIBCXX_DEFAULT_ABI_TAG
283 explicit operator bool() const noexcept
284 {
return _M_value != 0; }
315#if __cpp_lib_three_way_comparison
317 inline strong_ordering
320 if (
auto __c = __lhs.category() <=> __rhs.category(); __c != 0)
322 return __lhs.value() <=> __rhs.value();
328 return (__lhs.category() < __rhs.category()
329 || (__lhs.category() == __rhs.category()
330 && __lhs.value() < __rhs.value()));
339 template<
typename _CharT,
typename _Traits>
340 basic_ostream<_CharT, _Traits>&
341 operator<<(basic_ostream<_CharT, _Traits>& __os,
const error_code& __e)
342 {
return (__os << __e.category().name() <<
':' << __e.value()); }
358 template<
typename _ErrorConditionEnum>
360 = __enable_if_t<is_error_condition_enum<_ErrorConditionEnum>::value>;
369 : _M_value(__v), _M_cat(&__cat) { }
372 template<
typename _ErrorConditionEnum,
373 typename = _Check<_ErrorConditionEnum>>
376 using __adl_only::make_error_condition;
401 value() const noexcept {
return _M_value; }
409 _GLIBCXX_DEFAULT_ABI_TAG
416 explicit operator bool() const noexcept
417 {
return _M_value != 0; }
436 inline error_condition
453 return __lhs.category() == __rhs.category()
454 && __lhs.value() == __rhs.value();
469 return __lhs.category().equivalent(__lhs.value(), __rhs)
470 || __rhs.category().equivalent(__lhs, __rhs.value());
485 return __lhs.category() == __rhs.category()
486 && __lhs.value() == __rhs.value();
497#if __cpp_lib_three_way_comparison
499 inline strong_ordering
503 if (
auto __c = __lhs.category() <=> __rhs.category(); __c != 0)
505 return __lhs.value() <=> __rhs.value();
512 return (__lhs.category() < __rhs.category()
513 || (__lhs.category() == __rhs.category()
514 && __lhs.value() < __rhs.value()));
519 operator==(
const error_condition& __lhs,
const error_code& __rhs)
noexcept
521 return (__rhs.category().equivalent(__rhs.value(), __lhs)
522 || __lhs.category().equivalent(__rhs, __lhs.value()));
527 operator!=(
const error_code& __lhs,
const error_code& __rhs)
noexcept
528 {
return !(__lhs == __rhs); }
532 operator!=(
const error_code& __lhs,
const error_condition& __rhs)
noexcept
533 {
return !(__lhs == __rhs); }
537 operator!=(
const error_condition& __lhs,
const error_code& __rhs)
noexcept
538 {
return !(__lhs == __rhs); }
542 operator!=(
const error_condition& __lhs,
543 const error_condition& __rhs)
noexcept
544 {
return !(__lhs == __rhs); }
578 _M_code(__v, __ecat) { }
582 _M_code(__v, __ecat) { }
584#if __cplusplus >= 201103L
592 code()
const noexcept {
return _M_code; }
595_GLIBCXX_END_NAMESPACE_VERSION
600namespace std _GLIBCXX_VISIBILITY(default)
602_GLIBCXX_BEGIN_NAMESPACE_VERSION
604#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
610 :
public __hash_base<size_t, error_code>
613 operator()(
const error_code& __e)
const noexcept
615 const size_t __tmp = std::_Hash_impl::hash(__e.
value());
616 return std::_Hash_impl::__hash_combine(&__e.
category(), __tmp);
621#if __cplusplus >= 201703L
627 :
public __hash_base<size_t, error_condition>
632 const size_t __tmp = std::_Hash_impl::hash(__e.
value());
633 return std::_Hash_impl::__hash_combine(&__e.
category(), __tmp);
638_GLIBCXX_END_NAMESPACE_VERSION
bool operator==(const error_condition &__lhs, const error_condition &__rhs) noexcept
const error_category & generic_category() noexcept
Error category for errno error codes.
bool operator==(const error_code &__lhs, const error_condition &__rhs) noexcept
error_code make_error_code(errc __e) noexcept
bool operator==(const error_code &__lhs, const error_code &__rhs) noexcept
error_condition make_error_condition(errc __e) noexcept
const error_category & system_category() noexcept
Error category for other error codes defined by the OS.
error_condition make_error_condition(future_errc __errc) noexcept
Overload of make_error_condition for future_errc.
error_code make_error_code(future_errc __errc) noexcept
Overload of make_error_code for future_errc.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
ISO C++ entities toplevel namespace is std.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
One of two subclasses of exception.
Primary class template hash.
virtual bool equivalent(int __i, const error_condition &__cond) const noexcept
Test whether cond corresponds to i for this category.
virtual bool equivalent(const error_code &__code, int __i) const noexcept
Test whether code corresponds to i for this category.
bool operator==(const error_category &__other) const noexcept
An error_category only compares equal to itself.
virtual const char * name() const noexcept=0
A string that identifies the error category.
virtual error_condition default_error_condition(int __i) const noexcept
Return an error_condition corresponding to i in this category.
const error_category & category() const noexcept
The error category that this error belongs to.
int value() const noexcept
The error value.
error_code(_ErrorCodeEnum __e) noexcept
Initialize with a user-defined type, by calling make_error_code.
string message() const
The category's description of the value.
error_condition default_error_condition() const noexcept
An error_condition for this error's category and value.
error_condition(_ErrorConditionEnum __e) noexcept
Initialize with a user-defined type, by calling make_error_condition.
const error_category & category() const noexcept
The error category that this error belongs to.
error_condition(int __v, const error_category &__cat) noexcept
Initialize with the specified value and category.
int value() const noexcept
The error value.
error_condition() noexcept
Initialize with a zero (no error) value and the generic category.
string message() const
The category's description of the value.
void assign(int __v, const error_category &__cat) noexcept
Set the value and category.
void clear() noexcept
Reset the value and category to the default-constructed state.
An exception type that includes an error_code value.
One of the comparison functors.