将std::map复制/插入到boost::bimap中
Copying/Inserting a std::map into a boost::bimap
我尝试将std::map的元素复制到boost::bimap中。我无法让std::copy工作(boost文档似乎表明bimap应该与std::copy兼容)。
我尝试了以下方法:
std::map<K, T> curves;
boost::bimap<boost::bimaps::set_of<K>,
boost::bimaps::multiset_of<T>> m_curves;
... // some initialisation of curves
std::copy(curves.begin(), curves.end(), std::inserter(m_curves,
m_curves.end())); // This fails
m_curves.insert(curves.begin(), curves.end()); // This fails too !
错误消息很长,以开头
1>C:Program Files (x86)Microsoft Visual Studio 8VCincludexutility(2266) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const std::pair<_Ty1,_Ty2>' (or there is no acceptable conversion)
1> with
1> [
1> _Ty1=const K,
1> _Ty2=std::string
1> ]
1> C:Program Files (x86)Microsoft Visual Studio 8VCincludeiterator(129): could be 'std::insert_iterator<_Container> &std::insert_iterator<_Container>::operator =(const boost::bimaps::relation::mutant_relation<TA,TB,Info,force_mutable> &)'
1> with
1> [
1> _Container=Focus::BMpCrvKeyToName,
1> TA=boost::bimaps::tags::tagged<const K,boost::bimaps::relation::member_at::left>,
1> TB=boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,
1> Info=boost::bimaps::detail::manage_additional_parameters<boost::mpl::na,boost::mpl::na,boost::mpl::na>::case_NNN::additional_info,
1> force_mutable=false
1> ]
bimap本身与map
的签名不兼容,但左视图是。尝试插入m_curves.left
:
m_curves.left.insert(curves.begin(), curves.end());
相关文章:
- 是否可以覆盖 "find" 和 "erase" boost::bimaps::bimap.left 的方法?怎么办?
- 是boost :: bimap超杀击功能
- C boost :: bimap insert()方法不起作用
- 将 boost::d ynamic_bitset<> 插入 boost::bimap
- Boost Bimap 在调试版本中占用太多内存
- 使用boost::关联属性映射插入boost::BIMAP..失败
- 使用 boost::asociative 属性映射和 boost::BIMAP 接口
- 如何在使用 Boost.bimap 时避免密钥复制
- 将std::map复制/插入到boost::bimap中
- 如何从静态列表构建Boost bimap
- 在现代C++中实现 bimap,无需 Boost
- find() problems with boost bimap
- 如何以无序和可变的方式使用boost::bimap
- 公开私人作用域Boost.BiMap迭代器的公共视图
- 使用带有boost::bimap的自定义分配器
- boost::bimap not taking vector_of
- OPERATOR_BRACKET_IS_NOT_SUPPORTED on boost::bimap
- 应该使用multimap、boost::bimap、multiset或任何其他数据结构
- 将指针与 Boost::bimap
- boost::bimap of shared_ptr & boost::transform_iterator