You just need to do
std::hash<std::thread::id>{}(std::this_thread::get_id())
to get a size_t
.
From cppreference:
The template specialization of
std::hash
for thestd::thread::id
class allows users to obtain hashes of the identifiers of threads.