operator==,!=,<,<=,>,>=,<=>(std::thread::id)

< cpp‎ | thread‎ | thread‎ | id
定义于头文件 <thread>
bool operator==( std::thread::id lhs, std::thread::id rhs ) noexcept;
(1) (C++11 起)
bool operator!=( std::thread::id lhs, std::thread::id rhs ) noexcept;
(2) (C++11 起)
(C++20 前)
bool operator< ( std::thread::id lhs, std::thread::id rhs ) noexcept;
(3) (C++11 起)
(C++20 前)
bool operator<=( std::thread::id lhs, std::thread::id rhs ) noexcept;
(4) (C++11 起)
(C++20 前)
bool operator> ( std::thread::id lhs, std::thread::id rhs ) noexcept;
(5) (C++11 起)
(C++20 前)
bool operator>=( std::thread::id lhs, std::thread::id rhs ) noexcept;
(6) (C++11 起)
(C++20 前)
std::strong_ordering operator<=>( std::thread::id lhs,
                                  std::thread::id rhs ) noexcept;
(7) (C++20 起)

比较二个线程标识符。

1-2) 检查 lhsrhs 是否表示同一线程或均不表示线程。
3-7) 以未指明的全序比较 lhsrhs

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

(C++20 起)

参数

lhs, rhs - 要比较的线程标识符

返回值

1-6) 若对应关系成立则为 true ,否则为 false
7) 若在该全序中 lhs 小于 rhs 则为 std::strong_ordering::less ;否则若在该全序中 rhs 小于 lhs 则为 std::strong_ordering::greater ;否则为 std::strong_ordering::equal

复杂度

常数。

参阅