My code:
typedef pair<int,int> Pair
tr1::unordered_map<Pair,bool> h;
h.insert(make_pair(Pair(0,0),true));
Erorr
undefined reference to `std::tr1::hash<std::pair<int, int> >::operator()(std::pair<int, int>) const'
Something I need to fix?
thanks
This happens because there is no specialization for
std::tr1::hash<Key>
withKey = std::pair<int, int>
. You must to specializestd::tr1::hash<Key>
withKey = std::pair<int, int>
before declaringtr1::unordered_map<Pair,bool> h;
. This happens becausestd
don't know how to hash apair<int, int>
.Following there is a example of how to specialize
std::tr1::hash<>