<thread>

public member type
<thread>

std::thread::id

class thread::id;
Thread id
此型別的值由 thread::get_idthis_thread::get_id 返回,用於標識執行緒。

預設構造thread::id 物件的值標識可連線執行緒,因此與此類執行緒的成員 thread::get_id 返回的值相等。

對於可連線執行緒thread::get_id 返回此型別的唯一值,該值不等於為任何其他可連線可連線執行緒返回的值。

請注意,某些庫實現可能會重用已終止的、不再可連線的執行緒的 thread::id 值。

成員函式

id() noexcept; //預設建構函式
構造代表所有可連線執行緒的 thread::id 值。
thread::id 物件是平凡可複製的。

非成員函式過載

bool operator== (thread::id lhs, thread::id rhs) noexcept;
bool operator!= (thread::id lhs, thread::id rhs) noexcept;
bool operator< (thread::id lhs, thread::id rhs) noexcept;
bool operator<= (thread::id lhs, thread::id rhs) noexcept;
bool operator> (thread::id lhs, thread::id rhs) noexcept;
bool operator>= (thread::id lhs, thread::id rhs) noexcept;
兩個 thread::id 物件相等,當且僅當它們表示同一個可連線執行緒,或者它們都表示可連線執行緒。
關係運算符建立的順序是實現定義的穩定全序,允許其用作關聯容器的鍵。
template <class charT, class traits>
basic_ostream<charT, traits>& operator<< (basic_ostream<charT,traits>& os, thread::id id);
id 的文字表示形式(以實現特定的方式)插入到 os 中。
插入兩個相等比較的 thread::id 物件會生成相同的文字表示。插入不同的 thread::id 值會生成不同的表示。

非成員類特化

template <class T> struct hash; //通用模板宣告
template<> struct hash<thread::id>;
一元函式物件類,定義了 hashthread::id 型別物件的特化(參見 hash)。

另見