mardi 5 juillet 2016

unordered_set of unordered_map fails on missing hash for type

I have the following nested data structure:

map<string, unordered_set<unordered_map<string, string> > > complicateMap;

Meaning, a map from string, to a set of maps from string to string.

When trying to compile, I'm getting:

error C2338: The C++ Standard doesn't provide a hash for this type.

Narrowing it down, I see that the problem is unordered_set<unordered_map<...> >

Seems like unordered_map, by itself, doesn't have a default hash.

Is there a better approach to this data structure? Or how to implement a hash for an entire map efficiently?

Aucun commentaire:

Enregistrer un commentaire