Namespaces
Variants

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

来自 zh.cppreference.net
 
 
 
 
 
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::compare_three_way()(this, &rhs)。

运算符 <、<=、>、>= 和 != 是 合成 自 operator<=> 和 operator== 分别。

(自 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 。