map::equal_range

来源:互联网 发布:华硕软件卸载 编辑:程序博客网 时间:2024/04/29 11:57
// 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' => 20upper bound points to: 'c' => 30

原创粉丝点击