乱写的

hash_multimap 中搜索指定的key对应的元素,最方便的是用 equal_range(_Key) 方法,它返回的是元素的区间迭代器,类似于下面这样
 
std::pair <Type::const_iterator, Type::const_iterator> pitPair;
 
后面这么写就搞定了:
 
pitPair= Type.equal_range(_Key);
Type::const_iterator it = pitPair.first;
 while (it != pitPair.second)
 {
   it++;
 }
 
比他妈的自己发明轮子强多了
Advertisements

About HyperIris

Wild Scientist
此条目发表在编程艺术分类目录。将固定链接加入收藏夹。

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s