29#ifndef _GLIBCXX_SYSTEM_ERROR
30#define _GLIBCXX_SYSTEM_ERROR 1
32#pragma GCC system_header
36#if __cplusplus < 201103L
44#if __cplusplus > 201703L
48namespace std _GLIBCXX_VISIBILITY(default)
50_GLIBCXX_BEGIN_NAMESPACE_VERSION
57 class error_condition;
61 template<
typename _Tp>
65 template<
typename _Tp>
72#if __cplusplus > 201402L
73 template <
typename _Tp>
74 inline constexpr bool is_error_code_enum_v =
75 is_error_code_enum<_Tp>::value;
76 template <
typename _Tp>
77 inline constexpr bool is_error_condition_enum_v =
78 is_error_condition_enum<_Tp>::value;
82_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
124#if _GLIBCXX_USE_CXX11_ABI
126 _GLIBCXX_DEFAULT_ABI_TAG
128 _M_message(
int)
const;
132 _GLIBCXX_DEFAULT_ABI_TAG
134 message(
int)
const = 0;
137 message(
int)
const = 0;
141 _M_message(
int)
const;
161 {
return this == &__other; }
164#if __cpp_lib_three_way_comparison
168 {
return std::compare_three_way()(
this, &__rhs); }
175 operator!=(
const error_category& __other)
const noexcept
176 {
return this != &__other; }
183 [[__nodiscard__, __gnu__::__const__]]
184 const error_category&
188 [[__nodiscard__, __gnu__::__const__]]
194_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
225 template<
typename _ErrorCodeEnum>
227 = __enable_if_t<is_error_code_enum<_ErrorCodeEnum>::value>;
234 : _M_value(__v), _M_cat(&__cat) { }
237 template<
typename _ErrorCodeEnum,
238 typename = _Check<_ErrorCodeEnum>>
241 using __adl_only::make_error_code;
262 value() const noexcept {
return _M_value; }
274 _GLIBCXX_DEFAULT_ABI_TAG
281 explicit operator bool() const noexcept
282 {
return _M_value != 0; }
313#if __cpp_lib_three_way_comparison
315 inline strong_ordering
318 if (
auto __c = __lhs.category() <=> __rhs.category(); __c != 0)
320 return __lhs.value() <=> __rhs.value();
326 return (__lhs.category() < __rhs.category()
327 || (__lhs.category() == __rhs.category()
328 && __lhs.value() < __rhs.value()));
337 template<
typename _CharT,
typename _Traits>
338 basic_ostream<_CharT, _Traits>&
339 operator<<(basic_ostream<_CharT, _Traits>& __os,
const error_code& __e)
340 {
return (__os << __e.category().name() <<
':' << __e.value()); }
356 template<
typename _ErrorConditionEnum>
358 = __enable_if_t<is_error_condition_enum<_ErrorConditionEnum>::value>;
367 : _M_value(__v), _M_cat(&__cat) { }
370 template<
typename _ErrorConditionEnum,
371 typename = _Check<_ErrorConditionEnum>>
374 using __adl_only::make_error_condition;
399 value() const noexcept {
return _M_value; }
407 _GLIBCXX_DEFAULT_ABI_TAG
414 explicit operator bool() const noexcept
415 {
return _M_value != 0; }
434 inline error_condition
451 return __lhs.category() == __rhs.category()
452 && __lhs.value() == __rhs.value();
467 return __lhs.category().equivalent(__lhs.value(), __rhs)
468 || __rhs.category().equivalent(__lhs, __rhs.value());
483 return __lhs.category() == __rhs.category()
484 && __lhs.value() == __rhs.value();
495#if __cpp_lib_three_way_comparison
497 inline strong_ordering
501 if (
auto __c = __lhs.category() <=> __rhs.category(); __c != 0)
503 return __lhs.value() <=> __rhs.value();
510 return (__lhs.category() < __rhs.category()
511 || (__lhs.category() == __rhs.category()
512 && __lhs.value() < __rhs.value()));
517 operator==(
const error_condition& __lhs,
const error_code& __rhs)
noexcept
519 return (__rhs.category().equivalent(__rhs.value(), __lhs)
520 || __lhs.category().equivalent(__rhs, __lhs.value()));
525 operator!=(
const error_code& __lhs,
const error_code& __rhs)
noexcept
526 {
return !(__lhs == __rhs); }
530 operator!=(
const error_code& __lhs,
const error_condition& __rhs)
noexcept
531 {
return !(__lhs == __rhs); }
535 operator!=(
const error_condition& __lhs,
const error_code& __rhs)
noexcept
536 {
return !(__lhs == __rhs); }
540 operator!=(
const error_condition& __lhs,
541 const error_condition& __rhs)
noexcept
542 {
return !(__lhs == __rhs); }
576 _M_code(__v, __ecat) { }
580 _M_code(__v, __ecat) { }
582#if __cplusplus >= 201103L
590 code()
const noexcept {
return _M_code; }
593_GLIBCXX_END_NAMESPACE_VERSION
598namespace std _GLIBCXX_VISIBILITY(default)
600_GLIBCXX_BEGIN_NAMESPACE_VERSION
602#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
608 :
public __hash_base<size_t, error_code>
611 operator()(
const error_code& __e)
const noexcept
613 const size_t __tmp = std::_Hash_impl::hash(__e.
value());
614 return std::_Hash_impl::__hash_combine(&__e.
category(), __tmp);
619#if __cplusplus >= 201703L
625 :
public __hash_base<size_t, error_condition>
630 const size_t __tmp = std::_Hash_impl::hash(__e.
value());
631 return std::_Hash_impl::__hash_combine(&__e.
category(), __tmp);
636_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.