mardi 23 mai 2017

Strange order in std::map with russian text

Easy map like this

std::map<std::string, std::vector<int>> container = {
    {"первый",{1}},
    {"второй",{2}},
    {"третий",{3}},
    {"четвертый",{ 4 }}
};

for (auto it = container.begin(); it != container.end(); ++it)
{
    auto tt = it;
    // do smth
}

but in order second element ({"второй",{2}},) go first

enter image description here

and this is text dependent - for example if second element will be with english text "second" ({"second",{2}},) - order will be normal, and this will be second element in order.

Who can explain what happened, or this is just bug in VS 2017 version 15.3 ?

Aucun commentaire:

Enregistrer un commentaire