Is there a way to sort std::map by the data rather than the key? Right now my code duplicates the entire map in to an array just to do this.
+1
A:
As far as I can remember, std::map
will give you the iterator that will go through the items sorted by the key. Only way to go through the sorted items by the value, and still use the map, is to rewrite whole collection to another map, with key and value reversed.
Daniel Mošmondor
2010-10-22 00:07:23
I found that using a single vector and simply finding stuff was better.
Jookia
2010-10-22 00:33:03