C++ Language/Std/Stl/CollectionClasses/SortedCollections/Map/SortClass
The ordering of items does not matter in a map-literal.
What does matter is the "sort-class" template-parameter (the default is std::less<>
if omitted).
The sort-class determines the actual item-ordering within STL's internal representation (by ordering their keys).
When iterators use ++
and --
, they follow that sort-class order (not the map-literal's apparent order).
Additional information about specifying a sort-class (includes interactive examples)