命名空间
变体
操作

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