29 #ifndef _GLIBCXX_SYSTEM_ERROR
30 #define _GLIBCXX_SYSTEM_ERROR 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
43 namespace std _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
52 class error_condition;
56 template<
typename _Tp>
60 template<
typename _Tp>
67 #if __cplusplus > 201402L
68 template <
typename _Tp>
69 inline constexpr
bool is_error_code_enum_v =
70 is_error_code_enum<_Tp>::value;
71 template <
typename _Tp>
72 inline constexpr
bool is_error_condition_enum_v =
73 is_error_condition_enum<_Tp>::value;
75 inline namespace _V2 {
97 name()
const noexcept = 0;
103 #if _GLIBCXX_USE_CXX11_ABI
105 _GLIBCXX_DEFAULT_ABI_TAG
107 _M_message(
int)
const;
110 _GLIBCXX_DEFAULT_ABI_TAG
112 message(
int)
const = 0;
115 message(
int)
const = 0;
119 _M_message(
int)
const;
124 default_error_condition(
int __i)
const noexcept;
130 equivalent(
const error_code& __code,
int __i)
const noexcept;
138 {
return this == &__other; }
142 {
return this != &__other; }
177 : _M_value(__v), _M_cat(&__cat) { }
179 template<
typename _ErrorCodeEnum,
typename =
typename
182 { *
this = make_error_code(__e); }
196 template<
typename _ErrorCodeEnum>
199 operator=(_ErrorCodeEnum __e) noexcept
200 {
return *
this = make_error_code(__e); }
203 value()
const noexcept {
return _M_value; }
206 category()
const noexcept {
return *_M_cat; }
209 default_error_condition()
const noexcept;
211 _GLIBCXX_DEFAULT_ABI_TAG
214 {
return category().message(value()); }
216 explicit operator bool()
const noexcept
217 {
return _M_value != 0; }
236 return (__lhs.category() < __rhs.category()
237 || (__lhs.category() == __rhs.category()
238 && __lhs.value() < __rhs.value()));
241 template<
typename _CharT,
typename _Traits>
242 basic_ostream<_CharT, _Traits>&
243 operator<<(basic_ostream<_CharT, _Traits>& __os,
const error_code& __e)
244 {
return (__os << __e.category().name() <<
':' << __e.value()); }
265 : _M_value(__v), _M_cat(&__cat) { }
267 template<
typename _ErrorConditionEnum,
typename =
typename
280 template<
typename _ErrorConditionEnum>
283 operator=(_ErrorConditionEnum __e) noexcept
292 value()
const noexcept {
return _M_value; }
295 category()
const noexcept {
return *_M_cat; }
297 _GLIBCXX_DEFAULT_ABI_TAG
300 {
return category().message(value()); }
302 explicit operator bool()
const noexcept
303 {
return _M_value != 0; }
325 return (__lhs.category() < __rhs.category()
326 || (__lhs.category() == __rhs.category()
327 && __lhs.value() < __rhs.value()));
335 {
return (__lhs.category() == __rhs.category()
336 && __lhs.value() == __rhs.value()); }
343 return (__lhs.category().equivalent(__lhs.value(), __rhs)
344 || __rhs.category().equivalent(__lhs, __rhs.value()));
352 return (__rhs.category().equivalent(__rhs.value(), __lhs)
353 || __lhs.category().equivalent(__rhs, __lhs.value()));
361 return (__lhs.category() == __rhs.category()
362 && __lhs.value() == __rhs.value());
368 {
return !(__lhs == __rhs); }
374 {
return !(__lhs == __rhs); }
380 {
return !(__lhs == __rhs); }
386 {
return !(__lhs == __rhs); }
407 :
runtime_error(__what +
": " + __ec.message()), _M_code(__ec) { }
410 :
runtime_error(__what + (
": " + __ec.message())), _M_code(__ec) { }
417 _M_code(__v, __ecat) { }
421 _M_code(__v, __ecat) { }
423 #if __cplusplus >= 201103L
431 code()
const noexcept {
return _M_code; }
434 _GLIBCXX_END_NAMESPACE_VERSION
439 namespace std _GLIBCXX_VISIBILITY(default)
441 _GLIBCXX_BEGIN_NAMESPACE_VERSION
443 #ifndef _GLIBCXX_COMPATIBILITY_CXX0X
449 :
public __hash_base<size_t, error_code>
452 operator()(
const error_code& __e)
const noexcept
454 const size_t __tmp = std::_Hash_impl::hash(__e.value());
455 return std::_Hash_impl::__hash_combine(&__e.category(), __tmp);
458 #endif // _GLIBCXX_COMPATIBILITY_CXX0X
460 #if __cplusplus >= 201703L
466 :
public __hash_base<size_t, error_condition>
471 const size_t __tmp = std::_Hash_impl::hash(__e.value());
472 return std::_Hash_impl::__hash_combine(&__e.category(), __tmp);
477 _GLIBCXX_END_NAMESPACE_VERSION
482 #endif // _GLIBCXX_SYSTEM_ERROR