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

来自cppreference.com
< cpp‎ | thread‎ | thread‎ | id
 
 
线程支持库
线程
(C++11)
(C++20)
(C++20)
this_thread 命名空间
(C++11)
(C++11)
(C++11)
互斥
(C++11)
通用锁管理
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
条件变量
(C++11)
信号量
闩与屏障
(C++20)
(C++20)
future
(C++11)
(C++11)
(C++11)
(C++11)
 
 
std::thread::id
成员函数
非成员函数
operator==operator!=operator<operator<=operator>operator>=operator<=>
(C++20 前)(C++20 前)(C++20 前)(C++20 前)(C++20 前)(C++20)
辅助类
 
定义于头文件 <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

复杂度

常数。

参阅