vendredi 30 décembre 2016

C++: loop a std::unordered_map, the sequence is always the sequence I insert elements?

I constructed a std::unordered_map and use for loop to visit it. I found that the sequence of the iteration result shows the elements is put in the sequence that I created those elements, no matter how I inserted them.

Is this part of C++ standard that unordered_map, when visited, the iteration sequence is the insertion sequence? Or this is implementation preference?

I ask this question is, I wish to know if this feature, is something I can rely in my c++ code?

Aucun commentaire:

Enregistrer un commentaire