65,209
社区成员
发帖
与我相关
我的任务
分享
typedef vector<int> Vec_Tid;
typedef map<int, Vec_Tid> Map_Cid;
Vec_Tid vec_tid;
Map_Cid map_cid;
Vec_Tid::iterator it_vec;
Map_Cid::iterator it_map;
//实现按照vector中的int值查找;
//如果有vector中的int值,就返回这个map键。(可能多个键中包含);
//请教如何实现;
for( Map_Cid::iterator it_map = map_cid.begin(); it_map != map_cid.end() ; it_map++ )
{
if( it_map->second.end() != std::find( it_map->second.begin(), it_map->second.end() , 22 ) )
{
vec_tid.push_back( it_map->first );
}
}
[/quote]
只能如此了,还好表格不大 for( Map_Cid::iterator it_map = map_cid.begin(); it_map != map_cid.end() ; it_map++ )
{
if( it_map->second.end() != std::find( it_map->second.begin(), it_map->second.end() , 22 ) )
{
vec_tid.push_back( it_map->first );
}
}