命名空间
变体
操作

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

来自 cppreference.cn
 
 
 
 
std::error_category
成员函数
error_category::operator==error_category::operator!=error_category::operator<error_category::operator<=>
(直到 C++20)(直到 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) 检查 *thisrhs 是否引用同一对象。
2) 检查 *thisrhs 是否不引用同一对象。
3) 通过 this&rhs 的顺序对 *thisrhs 进行排序。等价于 std::less<const error_category*>()(this, &rhs)
4) 通过 this&rhs 的顺序对 *thisrhs 进行排序。等价于 std::compare_three_way()(this, &rhs)

<<=>>=!= 运算符分别从 operator<=>operator== 合成

(自 C++20 起)

[编辑] 参数

rhs - 指定要比较的 error_category

[编辑] 返回值

1) 如果 *thisrhs 引用同一对象,则为 true,否则为 false
2) 如果 *thisrhs 不引用同一对象,则为 true,否则为 false
3) 如果 *this 小于 rhs (根据 this&rhs 的顺序定义),则为 true
4) 如果 *this 小于 rhs (根据 this&rhs 的顺序定义),则为 std::strong_order::less,否则如果 rhs 小于 *this (按照此顺序),则为 std::strong_order::greater,否则为 std::strong_order::equal