29 #ifndef _GLIBCXX_SYSTEM_ERROR
30 #define _GLIBCXX_SYSTEM_ERROR 1
32 #ifdef _GLIBCXX_SYSHDR
33 #pragma GCC system_header
38 #if __cplusplus < 201103L
46 #if __cplusplus > 201703L
50 namespace 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)
120 name()
const noexcept = 0;
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;
149 default_error_condition(
int __i)
const noexcept;
157 equivalent(
const error_code& __code,
int __i)
const noexcept;
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__]]
191 const error_category&
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>&
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); }
545 #endif // three_way_comparison
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
600 namespace 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);
619 #endif // _GLIBCXX_COMPATIBILITY_CXX0X
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
643 #endif // _GLIBCXX_SYSTEM_ERROR