C++ STL map

简介

遍历

// 正向遍历
map<int, int>::iterator i = mymap.begin();
while(i != mymap.end()){
    cout << i->first << " " << i->second;
    i++
}

// 反向遍历
map<int, int>::reverse_iterator i = mymap.rbegin();
while(i != mymap.rend()){
    cout << i->first << " " << i->second;
    i++
}
原文地址:https://www.cnblogs.com/woxiaosade/p/12315129.html