Namespaces
Variants

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

From cppreference.net
Utilities library
std::error_category
Member functions
error_category::operator== error_category::operator!= error_category::operator< error_category::operator<=>
(until C++20) (until C++20) (C++20)
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 的地址顺序对二者进行排序。等价于 std:: compare_three_way ( ) ( this, & rhs )

< <= > >= != 运算符分别由 operator <=> operator == 自动合成。

(since C++20)

参数

rhs - 指定要比较的 error_category

返回值

1) true * this rhs 引用同一对象, false 否则。
2) true * this rhs 未引用同一对象,否则为 false
3) true 如果 * this 按照 this & rhs 的排序规则小于 rhs
4) std :: strong_order :: less * this this & rhs 的排序规则小于 rhs ;否则为 std :: strong_order :: greater rhs 在该排序中小于 * this ;否则为 std :: strong_order :: equal