Boost bimap无法编译:Visual Studio 2010

时间:2014-11-11 11:38:23

标签: c++ visual-studio-2010 boost

我尝试使用boost :: bimap来提供某些节点号的双向映射。我一直在使用boost无序映射来处理其他一些事情,并且使用它们没有任何问题。我在视觉工作室2010上。

然而,每当我尝试使用bimap时,我都会遇到大量的模板错误。即使从here处的示例中剪切和粘贴代码,我也会遇到大量模板问题。例如:我直接从示例中插入了此代码:

typedef boost::bimap< int, std::string > bm_type;
bm_type bm;

bm.insert( bm_type::value_type(1, "one" ) );
bm.insert( bm_type::value_type(2, "two" ) );

我得到大约750行错误,从这开始:

c:\data\boost\boost_1_56_0\boost\bimap\relation\mutant_relation.hpp(94): error C2220: warning treated as error - no 'object' file generated
1>          c:\data\boost\boost_1_56_0\boost\bimap\relation\mutant_relation.hpp(157) : see reference to class template instantiation 'boost::bimaps::relation::detail::relation_storage<LeftType,RightType,force_mutable>' being compiled
1>          with
1>          [
1>              LeftType=boost::bimaps::tags::tagged<const int,boost::bimaps::relation::member_at::left>,
1>              RightType=boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,
1>              force_mutable=false
1>          ]

结尾
IteratorToBaseConverter=boost::bimaps::container_adaptor::support::iterator_facade_to_base<boost::bimaps::detail::map_view_iterator<boost::bimaps::relation::member_at::right,boost::bimaps::detail::bimap_core<int,std::string,boost::mpl::na,boost::mpl::na,boost::mpl::na>>,boost::bimaps::detail::const_map_view_iterator<boost::bimaps::relation::member_at::right,boost::bimaps::detail::bimap_core<int,std::string,boost::mpl::na,boost::mpl::na,boost::mpl::na>>>,
1>              IteratorFromBaseConverter=boost::mpl::na,
1>              ReverseIteratorFromBaseConverter=boost::mpl::na,
1>              ValueToBaseConverter=boost::bimaps::relation::detail::pair_to_relation_functor<boost::bimaps::relation::member_at::right,boost::bimaps::relation::mutant_relation<boost::bimaps::tags::tagged<const int,boost::bimaps::relation::member_at::left>,boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,boost::bimaps::detail::manage_additional_parameters<boost::mpl::na,boost::mpl::na,boost::mpl::na>::case_NNN::additional_info,true>>,
1>              ValueFromBaseConverter=boost::bimaps::relation::support::get_pair_functor<boost::bimaps::relation::member_at::right,boost::bimaps::relation::mutant_relation<boost::bimaps::tags::tagged<const int,boost::bimaps::relation::member_at::left>,boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,boost::bimaps::detail::manage_additional_parameters<boost::mpl::na,boost::mpl::na,boost::mpl::na>::case_NNN::additional_info,true>>
1>          ]
1>c:\data\my_code.cpp(194): error C2665: 'boost::bimaps::relation::mutant_relation<TA,TB,Info,force_mutable>::mutant_relation' : none of the 5 overloads could convert all the argument types
1>          with
1>          [
1>              TA=boost::bimaps::tags::tagged<const int,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>          ]
1>          c:\data\boost\boost_1_56_0\boost\bimap\relation\mutant_relation.hpp(265): could be 'boost::bimaps::relation::mutant_relation<TA,TB,Info,force_mutable>::mutant_relation(const int,const std::basic_string<_Elem,_Traits,_Ax> &)'
1>          with
1>          [
1>              TA=boost::bimaps::tags::tagged<const int,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>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Ax=std::allocator<char>
1>          ]
1>          while trying to match the argument list '(int, int)'

Linux机器上的相同代码编译没有错误。任何帮助最感谢! 如下面的评论所述,行

  boost::bimap< int, std::string > test;

本身会触发类似的错误。忽略上面关于(int,int)的错误,我在使用boost :: bimap的代码中留下了一行。现在删除了,错误量没有重大变化。

0 个答案:

没有答案