C++ 参考手册

位置:首页 > C++ 参考手册 >线程支持库 >std::thread >std::thread::id > operator==,!=,<,<=,>,>=,<=>(std::thread::id)

bool operator==( thread::id lhs, thread::id rhs ) noexcept;
(1) (C++11 起)
bool operator!=( thread::id lhs, thread::id rhs ) noexcept;
(2) (C++11 起)
(C++20 前)
bool operator<( thread::id lhs, thread::id rhs ) noexcept;
(3) (C++11 起)
(C++20 前)
bool operator<=( thread::id lhs, thread::id rhs ) noexcept;
(4) (C++11 起)
(C++20 前)
bool operator>( thread::id lhs, thread::id rhs ) noexcept;
(5) (C++11 起)
(C++20 前)
bool operator>=( thread::id lhs, thread::id rhs ) noexcept;
(6) (C++11 起)
(C++20 前)
std::strong_ordering operator<=>( thread::id lhs, thread::id rhs ) noexcept;
(7) (C++20 起)


比较二个线程标识符。

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

参数

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

返回值

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

复杂度

常数。

参阅