You can use the streaming feature:
struct Hasher
{
size_t operator()(const boost::thread::id& id)
{
std::ostringstream os; os << id; return hash(os.str());
}
};
A short excerpt from the class so that others can see what is possible:
class thread::id
{
public:
id();
bool operator==(const id& y) const;
bool operator!=(const id& y) const;
bool operator<(const id& y) const;
bool operator>(const id& y) const;
bool operator<=(const id& y) const;
bool operator>=(const id& y) const;
template<class charT, class traits>
friend std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const id& x);
};
source
share