简体   繁体   English

如何将键值对引用从一个映射复制到另一个相同类型的映射?

[英]How do I copy key value pair references from one map to another map of the same type?

I have two maps in C++ of type std::map < std::string , std::vector < std::set< std::string>::iterator>> . 我在C ++中有两个类型为std::map < std::string , std::vector < std::set< std::string>::iterator>>

  1. catalog
  2. duplicatesCatalog

I would like to insert the reference of elements of catalog(key,value) into duplicatesCatalog on a scenario where the size of the vector of iterators in catalog is greater than 2. 我想在目录中迭代器向量的大小大于2的情况下,将catalog(key,value)元素的引用插入duplicatesCatalog副本目录中。

How do I do it? 我该怎么做?

使用std::reference_wrapper作为duplicatesCatalog参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM