@@ -76,7 +76,6 @@ public:
76
76
};
77
77
78
78
// non-member functions:
79
- bool operator<(const error_code& lhs, const error_code& rhs) noexcept;
80
79
template <class charT, class traits>
81
80
basic_ostream<charT,traits>&
82
81
operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
@@ -103,8 +102,6 @@ public:
103
102
explicit operator bool() const noexcept;
104
103
};
105
104
106
- bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept;
107
-
108
105
class system_error
109
106
: public runtime_error
110
107
{
@@ -129,12 +126,16 @@ error_condition make_error_condition(errc e) noexcept;
129
126
// Comparison operators:
130
127
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
131
128
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
132
- bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
129
+ bool operator==(const error_condition& lhs, const error_code& rhs) noexcept; // removed in C++20
133
130
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
134
- bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
135
- bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
136
- bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
137
- bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
131
+ bool operator!=(const error_code& lhs, const error_code& rhs) noexcept; // removed in C++20
132
+ bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept; // removed in C++20
133
+ bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept; // removed in C++20
134
+ bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept; // removed in C++20
135
+ bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept; // removed in C++20
136
+ bool operator<(const error_code& lhs, const error_code& rhs) noexcept; // removed in C++20
137
+ strong_ordering operator<=>(const error_code& lhs, const error_code& rhs) noexcept; // C++20
138
+ strong_ordering operator<=>(const error_condition& lhs, const error_condition& rhs) noexcept; // C++20
138
139
139
140
template <> struct hash<std::error_code>;
140
141
template <> struct hash<std::error_condition>;
@@ -314,14 +315,6 @@ make_error_condition(errc __e) _NOEXCEPT
314
315
return error_condition (static_cast <int >(__e), generic_category ());
315
316
}
316
317
317
- inline _LIBCPP_INLINE_VISIBILITY
318
- bool
319
- operator <(const error_condition& __x, const error_condition& __y) _NOEXCEPT
320
- {
321
- return __x.category () < __y.category ()
322
- || (__x.category () == __y.category () && __x.value () < __y.value ());
323
- }
324
-
325
318
// error_code
326
319
327
320
class _LIBCPP_TYPE_VIS error_code
@@ -390,14 +383,6 @@ make_error_code(errc __e) _NOEXCEPT
390
383
return error_code (static_cast <int >(__e), generic_category ());
391
384
}
392
385
393
- inline _LIBCPP_INLINE_VISIBILITY
394
- bool
395
- operator <(const error_code& __x, const error_code& __y) _NOEXCEPT
396
- {
397
- return __x.category () < __y.category ()
398
- || (__x.category () == __y.category () && __x.value () < __y.value ());
399
- }
400
-
401
386
inline _LIBCPP_INLINE_VISIBILITY
402
387
bool
403
388
operator ==(const error_code& __x, const error_code& __y) _NOEXCEPT
@@ -413,12 +398,14 @@ operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT
413
398
|| __y.category ().equivalent (__x, __y.value ());
414
399
}
415
400
401
+ #if _LIBCPP_STD_VER <= 17
416
402
inline _LIBCPP_INLINE_VISIBILITY
417
403
bool
418
404
operator ==(const error_condition& __x, const error_code& __y) _NOEXCEPT
419
405
{
420
406
return __y == __x;
421
407
}
408
+ #endif
422
409
423
410
inline _LIBCPP_INLINE_VISIBILITY
424
411
bool
@@ -427,6 +414,8 @@ operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT
427
414
return __x.category () == __y.category () && __x.value () == __y.value ();
428
415
}
429
416
417
+ #if _LIBCPP_STD_VER <= 17
418
+
430
419
inline _LIBCPP_INLINE_VISIBILITY
431
420
bool
432
421
operator !=(const error_code& __x, const error_code& __y) _NOEXCEPT
@@ -447,6 +436,42 @@ bool
447
436
operator !=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
448
437
{return !(__x == __y);}
449
438
439
+ inline _LIBCPP_INLINE_VISIBILITY
440
+ bool
441
+ operator <(const error_condition& __x, const error_condition& __y) _NOEXCEPT
442
+ {
443
+ return __x.category () < __y.category ()
444
+ || (__x.category () == __y.category () && __x.value () < __y.value ());
445
+ }
446
+
447
+ inline _LIBCPP_INLINE_VISIBILITY
448
+ bool
449
+ operator <(const error_code& __x, const error_code& __y) _NOEXCEPT
450
+ {
451
+ return __x.category () < __y.category ()
452
+ || (__x.category () == __y.category () && __x.value () < __y.value ());
453
+ }
454
+
455
+ #else // _LIBCPP_STD_VER <= 17
456
+
457
+ inline _LIBCPP_HIDE_FROM_ABI strong_ordering
458
+ operator <=>(const error_code& __x, const error_code& __y) noexcept
459
+ {
460
+ if (auto __c = __x.category () <=> __y.category (); __c != 0 )
461
+ return __c;
462
+ return __x.value () <=> __y.value ();
463
+ }
464
+
465
+ inline _LIBCPP_HIDE_FROM_ABI strong_ordering
466
+ operator <=>(const error_condition& __x, const error_condition& __y) noexcept
467
+ {
468
+ if (auto __c = __x.category () <=> __y.category (); __c != 0 )
469
+ return __c;
470
+ return __x.value () <=> __y.value ();
471
+ }
472
+
473
+ #endif // _LIBCPP_STD_VER <= 17
474
+
450
475
template <>
451
476
struct _LIBCPP_TEMPLATE_VIS hash<error_code>
452
477
: public __unary_function<error_code, size_t >
0 commit comments