小编Pet*_*nen的帖子

如何仅在c ++中比较其他字段对?

我有比较对的这个问题.我想用到find()包含这样的对的vector:

vector<pair<PersonID, Cost>> friendlist;
Run Code Online (Sandbox Code Playgroud)

PersonID并且Cost都是常规的整数.而这里的问题是我想专门使用find()刚才的PersonID,我对此并不感兴趣Cost.

if(friendlist.begin(), friendlist.end(), std::make_pair(toid, Cost)) != 
friendlist.end() )
Run Code Online (Sandbox Code Playgroud)

toid这是我想在向量中寻找的id.那么我应该对make_pair需要的其他领域做些什么呢?

c++

1
推荐指数
1
解决办法
68
查看次数

标签 统计

c++ ×1