zoukankan      html  css  js  c++  java
  • 比较两个map里的数据

    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。

  • 相关阅读:
    14-快速排序
    linux上挂在windows的共享文件系统,大小写不敏感
    【mount】linux挂共享盘
    监控windows服务或者进程
    自定义时间间隔
    示例
    filebeat
    kafka
    文档碎片
    简单DOM操作
  • 原文地址:https://www.cnblogs.com/donggongdechen/p/10044354.html
Copyright © 2011-2022 走看看