std::error_category::operator==,!=,<,<=>

来自cppreference.com
 
 
 
 
 
bool operator==( const error_category& rhs ) const noexcept;
(1) (C++11 起)
bool operator!=( const error_category& rhs ) const noexcept;
(2) (C++11 起)
(C++20 前)
bool operator<( const error_category& rhs ) const noexcept;
(3) (C++11 起)
(C++20 前)
std::strong_ordering operator<=>( const error_category& rhs ) const noexcept;
(4) (C++20 起)

与另一错误类别比较。

1) 检查 *this 与 rhs 是否指代同一对象。
2) 检查 *this 与 rhs 是否不指代同一对象。
3) 按 this 与 &rhs 的顺序排序 *this 与 rhs。等价于 std::less<const error_category*>()(this, &rhs)。
4) 按 this 与 &rhs 的顺序排序 *this 与 rhs。等价于 std::std::compare_three_way()(this, &rhs)。

<、<=、>、>= 及 != 运算符分别从 operator<=> 与 operator== 合成。

(C++20 起)

参数

rhs - 指定要比较的 error_category

返回值

1) 若 *this 与 rhs 指代同一对象,则为 true,否则为 false。
2) 若 *this 与 rhs 不指代同一对象,则为 true,否则为 false。
3) 若按 this 与 &rhs 的顺序,*this 小于 rhs 则为 true。
4) 若按 this 与 &rhs 的顺序,*this 小于 rhs 则为 std::strong_ordering::less,否则若按该顺序 rhs 小于 *this 则为 std::strong_ordering::greater,否则为 std::strong_ordering::equal。