You need specialization for std :: hash, and you need the == operator, designed to handle hash collisions.
EDIT: You must also ensure that your type has a copy constructor (or let the compiler generate it for you), since STL containers have semantics of values.
EDIT2: as an example of how to do this, you can check out this other SO answer .
source share