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

来自cppreference.com
 
 
工具库
语言支持
类型支持(基本类型、RTTI)
库功能特性测试宏 (C++20)
动态内存管理
程序工具
协程支持 (C++20)
变参数函数
调试支持
(C++26)
三路比较
(C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
通用工具
日期和时间
函数对象
格式化库 (C++20)
(C++11)
关系运算符 (C++20 中弃用)
整数比较函数
(C++20)(C++20)(C++20)   
(C++20)
交换类型运算
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
常用词汇类型
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
初等字符串转换
(C++17)
(C++17)

 
 
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::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_ordering::less,否则若按该顺序 rhs 小于 *this 则为 std::strong_ordering::greater,否则为 std::strong_ordering::equal