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 =
78 template <
typename _Tp>
79 inline constexpr
bool is_error_condition_enum_v =
84 _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
111 constexpr error_category() noexcept =
default;
113 virtual ~error_category();
115 error_category(
const error_category&) =
delete;
116 error_category& operator=(
const error_category&) =
delete;
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 169 operator<=>(
const error_category& __rhs)
const noexcept
170 {
return std::compare_three_way()(
this, &__rhs); }
173 operator<(
const error_category& __other)
const noexcept
177 operator!=(
const error_category& __other)
const noexcept
178 {
return this != &__other; }
185 [[__nodiscard__, __gnu__::__const__]]
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; }
273 default_error_condition()
const noexcept;
276 _GLIBCXX_DEFAULT_ABI_TAG
279 {
return category().message(value()); }
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();
339 template<
typename _CharT,
typename _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
412 {
return category().message(value()); }
416 explicit operator bool() const noexcept
417 {
return _M_value != 0; }
497 #if __cpp_lib_three_way_comparison 499 inline strong_ordering
528 {
return !(__lhs == __rhs); }
533 {
return !(__lhs == __rhs); }
538 {
return !(__lhs == __rhs); }
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 int value() const noexcept
The error value.
An exception type that includes an error_code value.
error_code(_ErrorCodeEnum __e) noexcept
Initialize with a user-defined type, by calling make_error_code.
error_condition make_error_condition(errc __e) noexcept
const error_category & generic_category() noexcept
Error category for errno error codes.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
error_condition(_ErrorConditionEnum __e) noexcept
Initialize with a user-defined type, by calling make_error_condition.
One of the comparison functors.
virtual bool equivalent(int __i, const error_condition &__cond) const noexcept
Test whether cond corresponds to i for this category.
const error_category & category() const noexcept
The error category that this error belongs to.
Template class basic_ostream.
error_code make_error_code(future_errc __errc) noexcept
Overload of make_error_code for future_errc.
ISO C++ entities toplevel namespace is std.
error_condition() noexcept
Initialize with a zero (no error) value and the generic category.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
bool operator==(const error_code &__lhs, const error_condition &__rhs) noexcept
error_condition(int __v, const error_category &__cat) noexcept
Initialize with the specified value and category.
const error_category & category() const noexcept
The error category that this error belongs to.
One of two subclasses of exception.
void assign(int __v, const error_category &__cat) noexcept
Set the value and category.
string message() const
The category's description of the value.
string message() const
The category's description of the value.
error_condition make_error_condition(future_errc __errc) noexcept
Overload of make_error_condition for future_errc.
bool operator==(const error_category &__other) const noexcept
An error_category only compares equal to itself.
bool operator==(const error_code &__lhs, const error_code &__rhs) noexcept
void clear() noexcept
Reset the value and category to the default-constructed state.
int value() const noexcept
The error value.
Primary class template hash.
error_code make_error_code(errc __e) noexcept
bool operator==(const error_condition &__lhs, const error_condition &__rhs) noexcept
const error_category & system_category() noexcept
Error category for other error codes defined by the OS.