boost::multi_index



  • Folgendes Beispiel aus der boost-Doku http://www.boost.org/libs/multi_index/doc/tutorial.html

    #include <boost/multi_index_container_fwd.hpp>  
    #include <boost/multi_index/member.hpp>    
    #include <boost/multi_index/sequenced_index.hpp>
    #include <string>
    
    using namespace ::boost;
    using namespace ::boost::multi_index;
    
    struct employee
    {
      int         id;
      std::string name;
    
      employee(int id,const std::string& name):id(id),name(name){}
    
      bool operator<(const employee& e)const{return id<e.id;}
    };
    
    typedef multi_index_container<
      employee,
      indexed_by<
        // sort by employee::operator<
        ordered_unique<identity<employee> >,
    
        // sort by less<string> on name
        ordered_non_unique<member<employee,std::string,&employee::name> >
      > 
    > employee_set;
    
    int main()
    {    
      employee_set es1;  
    }
    

    quittiert mein Compiler (VC++ 7.1) mit

    error C2079: 'es1' verwendet undefiniertes class 'boost::multi_index::multi_index_container<Value,IndexSpecifierList>'
    with
    [
    Value=employee,
    IndexSpecifierList=boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<employee>>,boost::multi_index::ordered_non_unique<boost::multi_index::member<employee,std::string,pointer-to-member(0x4)>>>
    ]
    c:\Temp\rumspielen\main.cpp(39): Siehe Verweis auf Instanziierung der kompilierten Klassenvorlage 'boost::multi_index::multi_index_container<Value,IndexSpecifierList>'
    with
    [
    Value=employee,
    IndexSpecifierList=boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<employee>>,boost::multi_index::ordered_non_unique<boost::multi_index::member<employee,std::string,pointer-to-member(0x4)>>>
    ]
    c:\Temp\rumspielen\main.cpp(39): Siehe Verweis auf Instanziierung der kompilierten Klassenvorlage 'boost::multi_index::multi_index_container<Value,IndexSpecifierList>'
    with
    [
    Value=employee,
    IndexSpecifierList=boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<employee>>,boost::multi_index::ordered_non_unique<boost::multi_index::member<employee,std::string,pointer-to-member(0x4)>>>
    ]

    Hat schon mal jemand boost::mult_index verwendet? Kann mir jemand weiterhelfen?


Anmelden zum Antworten