As the standard says:
Internally, the elements in a map are always sorted by its key following a specific strict weak ordering criterion indicated by its internal comparison object (of type Compare).
So, elements are sorted automatically as you insert them to the map.
solved An unexpected sorting of const map