template <class DataType>
void ProcessMap(std::map<std::string, std::vector<DataType> > &mymapa, std::map<std::string, std::vector<DataType> > &mymapb) {
typename::std::map<std::string, std::vector<DataType> >::const_iterator it=mymapb.begin(), find_it;
for(;it!=mymapb.end();++it) {
find_it = mymapa.find(it->first);
if(find_it != mymapa.end()) {
std::cout<<find_it->first<<" ";
typename::std::vector<DataType>::const_iterator sit;
for(sit=find_it->second.begin(); sit!=find_it->second.end(); ++sit) {
std::cout<<*sit<<" ";
}
std::cout<<std::endl;
}
}
}
给定mymapb,mymapa,如果mymapb里的key出现在mymapa中,就打印出对应mymapa中的key和values。