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

来自cppreference.com
 
 
工具库
通用工具
日期和时间
函数对象
格式化库 (C++20)
(C++11)
关系运算符 (C++20 中弃用)
整数比较函数
(C++20)(C++20)(C++20)
(C++20)
swap 与类型运算
(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) 检查 *this 与 rhs 是否指代同一对象。
2) 检查 *this 与 rhs 是否不指代同一对象。
3) 按 this 与 &rhs 的顺序排序 *this 与 rhs 。等价于 std::less<const error_category*>()(this, &rhs) 。
4) 按 this 与 &rhs 的顺序排序 *this 与 rhs 。等价于 std::std::compare_three_way()(this, &rhs) 。

<、 <=、 >、 >= 及 != 运算符分别从 operator<=> 与 operator== 合成。

(C++20 起)

参数

rhs - 指定要比较的 error_category

返回值

1) 若 *this 与 rhs 指代同一对象,则为 true ,否则为 false 。
2) 若 *this 与 rhs 不指代同一对象,则为 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 。