Using pthread_t as a key in a map

Paolo Brandoli paolo.brandoli@gmail.com
Tue May 9 20:55:00 GMT 2006


I have a source code that uses the pthread_t as a key in a std::map.
Because pthread-win32 defines pthread_t as a structure, the compilation fails.

I added the following lines in my pthread.h header in order to allow
the usage of pthread_t in the map:

bool operator < (const ptw32_handle_t& left, const ptw32_handle_t& right)
{
    return left.p < right.p;
}

bool operator > (const ptw32_handle_t& left, const ptw32_handle_t& right)
{
    return left.p > right.p;
}

Bye
Paolo Brandoli
http://www.puntoexe.com



More information about the Pthreads-win32 mailing list