c++ - boost::multi_index error "template argument 'x' is invalid" -


so made kind of database boost_multi_index this:

#include <boost\multi_index_container.hpp> #include <boost\multi_index\ordered_index.hpp> #include <boost\multi_index\member.hpp> using namespace boost::multi_index; using namespace std;  struct list_entry{     int id;     string name;     string* data; };  typedef multi_index_container<list_entry,     indexed_by<         ordered_unique< tag<int>, member<list_entry, int, &list_entry::id>>,                // unique id         ordered_unique< tag<string>, member<list_entry, string, &list_entry::name>>,        // unique name         ordered_non_unique< tag<string*>, member<list_entry, string*, &list_entry::data>>   // data associated id/name     > >table;  class database {     private:             table music, names;         typedef table::index<int>::type list_id;         typedef table::index<string>::type list_string;      //some more code here }; 

and compiles fine visual studio 2010.

however wanted switch project on code::blocks mingw , seems he's not happy that, compile log:

.\source\db.h|19|error: template argument 3 invalid| .\source\db.h|15|error: template argument 2 invalid| .\source\db.h|15|error: template argument 1 invalid| .\source\db.h|14|error: template argument 2 invalid| .\source\db.h|13|warning: 'typedef' ignored in declaration [enabled default]| .\source\db.h|24|error: 'table' not name type| .\source\db.h|25|error: 'table' not name type| .\source\db.h|26|error: 'table' not name type| c:\program files\boost_1_54_0\boost\system\error_code.hpp|222|warning: 'boost::system::posix_category' defined not used [-wunused-variable]| c:\program files\boost_1_54_0\boost\system\error_code.hpp|223|warning: 'boost::system::errno_ecat' defined not used [-wunused-variable]| c:\program files\boost_1_54_0\boost\system\error_code.hpp|224|warning: 'boost::system::native_ecat' defined not used [-wunused-variable]| c:\program files\boost_1_54_0\boost\asio\error.hpp|244|warning: 'boost::asio::error::system_category' defined not used [-wunused-variable]| c:\program files\boost_1_54_0\boost\asio\error.hpp|246|warning: 'boost::asio::error::netdb_category' defined not used [-wunused-variable]| c:\program files\boost_1_54_0\boost\asio\error.hpp|248|warning: 'boost::asio::error::addrinfo_category' defined not used [-wunused-variable]| c:\program files\boost_1_54_0\boost\asio\error.hpp|250|warning: 'boost::asio::error::misc_category' defined not used [-wunused-variable]| c:\program files\boost_1_54_0\boost\asio\ssl\error.hpp|34|warning: 'boost::asio::error::ssl_category' defined not used [-wunused-variable]| c:\program files\boost_1_54_0\boost\asio\detail\winsock_init.hpp|116|warning: 'boost::asio::detail::winsock_init_instance' defined not used [-wunused-variable]| ||=== build finished: 7 errors, 10 warnings (0 minutes, 15 seconds) ===| 

i'm clueless since error not more specific , couldn't find related problem.

so hope can give me answer here, if more information required edit in afterwards.

i able solve issue using boost_multi_index_member this:

typedef multi_index_container<list_entry,     indexed_by<         ordered_unique< tag<int>, boost_multi_index_member(list_entry, int, id)>,         ordered_unique< tag<string>, boost_multi_index_member(list_entry, string, name)>,         ordered_non_unique< tag<string*>, boost_multi_index_member(list_entry, string*, data)>     > >table; 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -