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.
相关问题
- Sorting 3 numbers without branching [closed]
- How to toggle on Order in ReactJS
- PHP Recursively File Folder Scan Sorted by Modific
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
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.