I\'m using clang (CXX=\'clang++ -std=c++11 -stdlib=libc++\') on Mac OS X, with boost 1.53.0.
I want to use uuid as keys in unordered_map, but getting the following e
Why bug in boost? You should specialize std::hash template for boost::uuid.
#include <boost/functional/hash.hpp>
namespace std
{
template<>
struct hash<boost::uuids::uuid>
{
size_t operator () (const boost::uuids::uuid& uid)
{
return boost::hash<boost::uuids::uuid>()(uid);
}
};
}
or, simply create unordered_map with boost::hash par
std::unordered_map<boost::uuids::uuid, T, boost::hash<boost::uuids::uuid>>
or provide hash functor that satisfies requirements of std::hash (thanks to Praetorian).