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::hashfor thestd::thread::idclass allows users to obtain hashes of the identifiers of threads.