dimanche 21 avril 2019

Weird map read issue?

I have a map I need to read with an iterator loop, and this map reads with this loop in another section of my program, but for whatever reason, using this loop at another part doesn't let me read the last key of the map.

Here is an abstracted version of it:

cout<<map.size()<<endl;
for(auto it = map.begin(); it != map.end(); ++it)
{
    cout<<it->first<<endl;
}

Sample output:

4
a
b
c
d

Yet if I use this in another portion of code, the output is:

4
a
b
c

Any idea why this could be?

Aucun commentaire:

Enregistrer un commentaire