29 #ifndef _GLIBCXX_SYSTEM_ERROR
30 #define _GLIBCXX_SYSTEM_ERROR 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
42 #if __cplusplus > 201703L
46 namespace std _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 class error_condition;
59 template<
typename _Tp>
63 template<
typename _Tp>
70 #if __cplusplus > 201402L
71 template <
typename _Tp>
72 inline constexpr
bool is_error_code_enum_v =
73 is_error_code_enum<_Tp>::value;
74 template <
typename _Tp>
75 inline constexpr
bool is_error_condition_enum_v =
76 is_error_condition_enum<_Tp>::value;
80 inline namespace _V2 {
122 #if _GLIBCXX_USE_CXX11_ABI
124 _GLIBCXX_DEFAULT_ABI_TAG
126 _M_message(
int)
const;
130 _GLIBCXX_DEFAULT_ABI_TAG
132 message(
int)
const = 0;
135 message(
int)
const = 0;
139 _M_message(
int)
const;
159 {
return this == &__other; }
162 #if __cpp_lib_three_way_comparison
166 {
return std::compare_three_way()(
this, &__rhs); }
174 {
return this != &__other; }
181 [[__nodiscard__, __gnu__::__const__]]
182 const error_category&
186 [[__nodiscard__, __gnu__::__const__]]
227 : _M_value(__v), _M_cat(&__cat) { }
229 template<
typename _ErrorCodeEnum,
typename =
typename
233 using __adl_only::make_error_code;
249 template<
typename _ErrorCodeEnum>
252 operator=(_ErrorCodeEnum __e) noexcept
258 value() const noexcept {
return _M_value; }
270 _GLIBCXX_DEFAULT_ABI_TAG
273 {
return category().
message(value()); }
277 explicit operator bool() const noexcept
278 {
return _M_value != 0; }
309 #if __cpp_lib_three_way_comparison
311 inline strong_ordering
314 if (
auto __c = __lhs.category() <=> __rhs.category(); __c != 0)
316 return __lhs.value() <=> __rhs.value();
322 return (__lhs.category() < __rhs.category()
323 || (__lhs.category() == __rhs.category()
324 && __lhs.value() < __rhs.value()));
333 template<
typename _CharT,
typename _Traits>
359 : _M_value(__v), _M_cat(&__cat) { }
361 template<
typename _ErrorConditionEnum,
typename =
typename
365 using __adl_only::make_error_condition;
378 template<
typename _ErrorConditionEnum>
381 operator=(_ErrorConditionEnum __e) noexcept
394 value() const noexcept {
return _M_value; }
402 _GLIBCXX_DEFAULT_ABI_TAG
405 {
return category().message(value()); }
409 explicit operator bool() const noexcept
410 {
return _M_value != 0; }
429 inline error_condition
446 return __lhs.category() == __rhs.category()
447 && __lhs.value() == __rhs.value();
462 return __lhs.category().equivalent(__lhs.value(), __rhs)
463 || __rhs.category().equivalent(__lhs, __rhs.value());
478 return __lhs.category() == __rhs.category()
479 && __lhs.value() == __rhs.value();
490 #if __cpp_lib_three_way_comparison
492 inline strong_ordering
496 if (
auto __c = __lhs.category() <=> __rhs.category(); __c != 0)
498 return __lhs.value() <=> __rhs.value();
505 return (__lhs.category() < __rhs.category()
506 || (__lhs.category() == __rhs.category()
507 && __lhs.value() < __rhs.value()));
514 return (__rhs.category().equivalent(__rhs.value(), __lhs)
515 || __lhs.category().equivalent(__rhs, __lhs.value()));
520 operator!=(
const error_code& __lhs,
const error_code& __rhs) noexcept
521 {
return !(__lhs == __rhs); }
525 operator!=(
const error_code& __lhs,
const error_condition& __rhs) noexcept
526 {
return !(__lhs == __rhs); }
530 operator!=(
const error_condition& __lhs,
const error_code& __rhs) noexcept
531 {
return !(__lhs == __rhs); }
535 operator!=(
const error_condition& __lhs,
536 const error_condition& __rhs) noexcept
537 {
return !(__lhs == __rhs); }
571 _M_code(__v, __ecat) { }
575 _M_code(__v, __ecat) { }
577 #if __cplusplus >= 201103L
585 code()
const noexcept {
return _M_code; }
588 _GLIBCXX_END_NAMESPACE_VERSION
593 namespace std _GLIBCXX_VISIBILITY(default)
595 _GLIBCXX_BEGIN_NAMESPACE_VERSION
597 #ifndef _GLIBCXX_COMPATIBILITY_CXX0X
603 :
public __hash_base<size_t, error_code>
606 operator()(
const error_code& __e)
const noexcept
608 const size_t __tmp = std::_Hash_impl::hash(__e.
value());
609 return std::_Hash_impl::__hash_combine(&__e.
category(), __tmp);
614 #if __cplusplus >= 201703L
620 :
public __hash_base<size_t, error_condition>
625 const size_t __tmp = std::_Hash_impl::hash(__e.
value());
626 return std::_Hash_impl::__hash_combine(&__e.
category(), __tmp);
631 _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
const error_category & system_category() noexcept
Error category for other error codes defined by the OS.
error_condition make_error_condition(errc __e) noexcept
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.
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.
Template class basic_ostream.
One of two subclasses of exception.
Primary class template hash.
virtual error_condition default_error_condition(int __i) const noexcept
Return an error_condition corresponding to i in this category.
bool operator<(const error_category &__other) const noexcept
Ordered comparison that defines a total order for error categories.
virtual const char * name() const noexcept=0
A string that identifies the error category.
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.
int value() const noexcept
The error value.
const error_category & category() const noexcept
The error category that this error belongs to.
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.
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.
Define a member typedef type only if a boolean constant is true.
One of the comparison functors.