1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
// map::rbegin/rend
#include <iostream>
#include <map>
int main ()
{
std::map<char,int> mymap;
mymap['x'] = 100;
mymap['y'] = 200;
mymap['z'] = 300;
// show content:
std::map<char,int>::reverse_iterator rit;
for (rit=mymap.rbegin(); rit!=mymap.rend(); ++rit)
std::cout << rit->first << " => " << rit->second << '\n';
return 0;
}
|