// map::equal_elements
#include <iostream>
#include <map>
using namespace std;
int main ()
{
map<char,int> mymap;
pair<map<char,int>::iterator,map<char,int>::iterator> ret;
mymap['a']=10;
mymap['b']=20;
mymap['c']=30;
ret = mymap.equal_range('b');
cout << "lower bound points to: ";
cout << ret.first->first << " => " << ret.first->second << endl;
cout << "upper bound points to: ";
cout << ret.second->first << " => " << ret.second->second << endl;
return 0;
}
lower bound points to: 'b' => 20
upper bound points to: 'c' => 30
map::equal_range
最新推荐文章于 2023-06-01 08:30:00 发布