2012-08-29 3 views
4

std :: map 요소를 boost :: bimap에 복사 해 보았습니다. std :: copy를 사용할 수 없습니다 (부스트 문서는 bimap이 std :: copy와 호환되어야 함을 나타냅니다). 왼쪽보기는std :: map을 boost :: bimap에 복사/삽입

1>C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\xutility(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 8\VC\include\iterator(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>  ] 
+0

무엇이 오류 메시지입니까? – ecatmur

답변

6

bimap 자체 서명 호환 map하지 않고, :

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 ! 

오류 메시지가 매우 길고로 시작

는 내가이 다음을 시도 . m_curves.left에 삽입 해보십시오.

m_curves.left.insert(curves.begin(), curves.end()); 
+0

실제로 당신 말이 맞습니다! – BlueTrin

관련 문제