dimanche 28 juin 2015

Hash value for a std::unordered_map

According to the standard there's no support for containers (let alone unordered ones) in the std::hash class. So I wonder how to implement that. What I have is:

std::unordered_map<std::wstring, std::wstring> _properties;

I thought about iterating the entries, computing the individual hashes for keys and values (via std::hash<std::wstring>) and concatenate the results somehow.

What would be a good way to do that and does it matter if the order in the map is not defined?

Note: I don't want to use boost.

Aucun commentaire:

Enregistrer un commentaire