c++ - Are the elements in a std::map guaranteed to be ordered? -


Is this just an implementation side effect (red-black tree) or is the order guarantee by C ++ standard?

The ordered execution is not an implementation description; It is guaranteed by the C ++ standard; It is the basic asset of all the Associated Containers (C + 03 03 § 23.1.2 / 9):

The basic properties of the organizers of associative containers are: That they determine the sequence of non-keys through the container where the non-descending definition is defined, which was used to make them. From any two dereferenceable iterators i and j to that distance that i to j is positive,

  value_comp (* j, * i) == false  

value_comp comparator with which map was created (By default, this is std :: less

.

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -