64,654
社区成员
发帖
与我相关
我的任务
分享
multimap<string, string> authors;
string name("lisi");
authors.insert(make_pair(name, string("phone") ));//其中string()可以去掉
authors.insert(make_pair(name, string("address") ));
authors.insert(make_pair(name, string("email") ));
string name2("zhangsan");
authors.insert(make_pair(name2, string("phone") ));
typedef multimap<string , string>::iterator authors_it;
authors_it beg = authors.lower_bound(name),
end = authors.upper_bound(name);
while (beg != end)
{
cout << beg->second <<endl;
++beg;
}