F
FFMG
Hi,
If I have something like :
std::map<int, int> myMap;
myMap[200] = 1;
myMap[100] = 2;
myMap[300] = 3;
myMap[150] = 4;
What does the standard say that the output must be if I iterate thru
the map?
for( std::map< int, int>::const_iterator it = myMap.begin(); it !=
myMap.end(); ++it )
{
// output it->first
}
Is the output...
// 100
// 150
// 200
// 300
Or is it
// 200
// 100
// 300
// 150
Or can it be anything at all and I have no real guarantees ...
What I want to do is iterate though the map from the lowest integer to
the largest, do I need to re-order it first or do anything special.
How can I get the map in the right 'order'
Many thanks
FFMG
If I have something like :
std::map<int, int> myMap;
myMap[200] = 1;
myMap[100] = 2;
myMap[300] = 3;
myMap[150] = 4;
What does the standard say that the output must be if I iterate thru
the map?
for( std::map< int, int>::const_iterator it = myMap.begin(); it !=
myMap.end(); ++it )
{
// output it->first
}
Is the output...
// 100
// 150
// 200
// 300
Or is it
// 200
// 100
// 300
// 150
Or can it be anything at all and I have no real guarantees ...
What I want to do is iterate though the map from the lowest integer to
the largest, do I need to re-order it first or do anything special.
How can I get the map in the right 'order'
Many thanks
FFMG