I encountered the problem of trying to put custom data structures into the key of an unordered map and found different answers all over the Internet. The same question came up on the sparsehash mailing list so I thought I'd put an example up here:

The trick is to define both a hash and an equality function for the custom data structure. The prime numbers in the 3D vector hash function come from this paper. The "correct" hash function depends a lot on the distribution of the keys and only real world benchmarking will give a satisfactory answer as to what works best for your data.

The output of the above code would be something like: