Documentation Home >> Headers >> <thread> Header >> std::thread >> std::thread::id Class

An instance of std::thread::id identifies a particular thread of execution.

class thread::id
{
public:
    id();
};

bool operator==(thread::id x, thread::id y);
bool operator!=(thread::id x, thread::id y);
bool operator<(thread::id x, thread::id y);
bool operator<=(thread::id x, thread::id y);
bool operator>(thread::id x, thread::id y);
bool operator>=(thread::id x, thread::id y);

template<typename charT, typename traits>
basic_ostream<charT, traits>&
operator<< (
    basic_ostream<charT, traits>&& out,
    thread::id id);

The std::thread::id value that identifies a particular thread of execution shall be distinct from the value of a default-constructed std::thread::id instance, and from any value that represents another thread of execution.

The std::thread::id values for particular threads are not predictable and may vary between executions of the same program.

std::thread::id is CopyConstructible and CopyAssignable, so instances of std::thread::id may be freely copied and assigned.

Header

#include <thread>

See Also