mpl::map



  • Ist dieser Code richtig? Mein Compiler (VC8) meckert nämlich...

    #include <map>
    using namespace std;
    
    #include <boost/mpl/map.hpp>
    #include <boost/mpl/at.hpp>
    #include <boost/mpl/int.hpp>
    using namespace boost;
    
    typedef mpl::map<pair<mpl::int_<0>,int> > Map_t;
    mpl::at<Map_t,mpl::int_<0> >::type i;
    
    int main()
    {
    	return 0;
    }
    

    1>c:\boost\include\boost-1_34\boost\mpl\map\aux_\preprocessed\plain\map10.hpp(35) : error C2143: syntax error : missing ',' before 'std::pair<_Ty1,_Ty2>::first'
    1> with
    1> [
    1> _Ty1=boost::mpl::int_<0>,
    1> Ty2=int
    1> ]
    1> c:\boost\include\boost-1_34\boost\mpl\aux_\preprocessed\plain\map.hpp(44) : see reference to class template instantiation 'boost::mpl::map1<P0>' being compiled
    1> with
    1> [
    1> P0=std::pair<boost::mpl::int
    <0>,int>
    1> ]
    1> c:\boost\include\boost-1_34\boost\mpl\aux_\has_tag.hpp(20) : see reference to class template instantiation 'boost::mpl::map<T0>' being compiled
    1> with
    1> [
    1> T0=std::pair<boost::mpl::int_<0>,int>
    1> ]
    1> c:\boost\include\boost-1_34\boost\mpl\sequence_tag.hpp(112) : see reference to class template instantiation 'boost::mpl::aux::has_tag<T>' being compiled
    1> with
    1> [
    1> T=Map_t
    1> ]
    1> c:\boost\include\boost-1_34\boost\mpl\at.hpp(32) : see reference to class template instantiation 'boost::mpl::sequence_tag<Sequence>' being compiled
    1> with
    1> [
    1> Sequence=Map_t
    1> ]
    1> d:\visual studio projects\test\main.cpp(10) : see reference to class template instantiation 'boost::mpl::at<Sequence,N>' being compiled
    1> with
    1> [
    1> Sequence=Map_t,
    1> N=boost::mpl::int_<0>
    1> ]
    1>c:\boost\include\boost-1_34\boost\mpl\map\aux_\preprocessed\plain\map10.hpp(36) : error C2143: syntax error : missing ',' before 'std::pair<_Ty1,_Ty2>::second'
    1> with
    1> [
    1> _Ty1=boost::mpl::int_<0>,
    1> _Ty2=int
    1> ]
    1>c:\boost\include\boost-1_34\boost\mpl\map\aux_\preprocessed\plain\map10.hpp(37) : error C2977: 'boost::mpl::m_item' : too many template arguments
    1> c:\boost\include\boost-1_34\boost\mpl\map\aux_\item.hpp(79) : see declaration of 'boost::mpl::m_item'
    1>c:\boost\include\boost-1_34\boost\mpl\map\aux_\preprocessed\plain\map10.hpp(38) : error C2955: 'boost::mpl::m_item' : use of class template requires template argument list
    1> c:\boost\include\boost-1_34\boost\mpl\map\aux_\item.hpp(79) : see declaration of 'boost::mpl::m_item'
    1>c:\boost\include\boost-1_34\boost\mpl\map\aux_\preprocessed\plain\map10.hpp(38) : error C2504: 'boost::mpl::m_item' : base class undefined



  • typedef mpl::map<pair<mpl::int_<0>,int> > Map_t;
    

    wird durch zu

    typedef mpl::map<std::pair<mpl::int_<0>,int> > Map_t;
    

    um das zu verhindern:

    typedef mpl::map<mpl::pair<mpl::int_<0>,int> > Map_t;
    

    Maik


Anmelden zum Antworten