Help Required, trouble while using boost::multi_index

Hi, I am trying to create a ClassX using "boost::multi_index" and I was successfully able to create a ClassX like, typedef boost::multi_index_ClassX< ClassX*, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::const_mem_fun<ParentOfClassX, Int64, &ParentOfClassX::getKey1>, boost::multi_index::const_mem_fun<ParentOfClassX, Int64, &ParentOfClassX::getKey2>,
MultiIndexedClassX;
This compiles perfectly with no problems. I am writing the code and compiling with Visual Studio 2005 and have included, #include <boost/multi_index_container.hpp> #include "boost/multi_index/hashed_index_fwd.hpp" #include <boost/multi_index/mem_fun.hpp> and have defined namespaces, using namespace boost::multi_index; using boost::multi_index::multi_index_container; using boost::multi_index::hashed_unique; using boost::multi_index::indexed_by; But when I create an object of that type like, MultiIndexedClassX sample; I get a big list compilation errors like, *c:\code\common\lib\boost\boost\multi_index\detail\node_type.hpp(44) : error C2903: 'node_class' : symbol is neither a class template nor a function template* * c:\code\common\lib\boost\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'boost::multi_index::detail::index_node_applier::apply<IndexSpecifierIterator,Super>' being compiled* * with* * [* * IndexSpecifierIterator=boost::mpl::v_iter<boost::mpl::vector1<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<ParentOfClassX,GKey,ParentOfClassX::getKey1>,boost::multi_index::const_mem_fun<ParentOfClassX,Vs64,ParentOfClassX::getKey2>>>,0>,* * Super=boost::multi_index::detail::index_node_base<ClassX *,std::allocator<ClassX *>>* * ]* * c:\code\common\lib\boost\boost\mpl\aux_\preprocessed\plain\bind.hpp(207) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled* * with* * [* * F=boost::multi_index::detail::index_node_applier,* * T1=boost::mpl::v_iter<boost::mpl::vector1<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<ParentOfClassX,GKey,ParentOfClassX::getKey1>,boost::multi_index::const_mem_fun<ParentOfClassX,Vs64,ParentOfClassX::getKey2>>>,0>,* * T2=boost::multi_index::detail::index_node_base<ClassX *,std::allocator<ClassX *>>* * ]* * c:\code\common\lib\boost\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'boost::mpl::bind2<F,T1,T2>::apply<U1,U2>' being compiled* * with* * [* * F=boost::multi_index::detail::index_node_applier,* * T1=boost::mpl::_2,* * T2=boost::mpl::_1,* * U1=boost::multi_index::detail::index_node_base<ClassX *,std::allocator<ClassX *>>,* * U2=boost::mpl::v_iter<boost::mpl::vector1<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<ParentOfClassX,GKey,ParentOfClassX::getKey1>,boost::multi_index::const_mem_fun<ParentOfClassX,Vs64,ParentOfClassX::getKey2>>>,0>* * ]* * c:\code\common\lib\boost\boost\mpl\aux_\preprocessed\plain\apply.hpp(63) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled* * with* * [* * F=boost::mpl::bind2<boost::multi_index::detail::index_node_applier,boost::mpl::_2,boost::mpl::_1>,* * T1=boost::multi_index::detail::index_node_base<ClassX *,std::allocator<ClassX *>>,* * T2=boost::mpl::v_iter<boost::mpl::vector1<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<ParentOfClassX,GKey,ParentOfClassX::getKey1>,boost::multi_index::const_mem_fun<ParentOfClassX,Vs64,ParentOfClassX::getKey2>>>,0>* * ]* * c:\code\common\lib\boost\boost\mpl\aux_\preprocessed\plain\reverse_iter_fold_impl.hpp(58) : see reference to class template instantiation 'boost::mpl::apply2<F,T1,T2>' being compiled* * with* * [* * F=boost::mpl::bind2<boost::multi_index::detail::index_node_applier,boost::mpl::_2,boost::mpl::_1>,* * T1=boost::multi_index::detail::index_node_base<ClassX *,std::allocator<ClassX *>>,* * T2=boost::mpl::v_iter<boost::mpl::vector1<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<ParentOfClassX,GKey,ParentOfClassX::getKey1>,boost::multi_index::const_mem_fun<ParentOfClassX,Vs64,ParentOfClassX::getKey2>>>,0>* * ]* Thanks, Ram

El 16/09/2016 a las 14:44, Ram escribió:
Hi,
[...]
I am writing the code and compiling with Visual Studio 2005 and have included,
#include <boost/multi_index_container.hpp> #include "boost/multi_index/hashed_index_fwd.hpp"
boost/multi_index/hashed_index_fwd.hpp forward declares, rather than defines, hashed indices. Try using #include <boost/multi_index/hashed_index.hpp> HTH Joaquín M López Muñoz

Thanks Joaquin! That worked! I struggled the whole of yesterday. How would I find this on my own? Thanks, Ram On Sat, Sep 17, 2016 at 1:18 PM, Joaquin M López Muñoz < joaquinlopezmunoz@gmail.com> wrote:
El 16/09/2016 a las 14:44, Ram escribió:
Hi,
[...]
I am writing the code and compiling with Visual Studio 2005 and have included,
#include <boost/multi_index_container.hpp> #include "boost/multi_index/hashed_index_fwd.hpp"
boost/multi_index/hashed_index_fwd.hpp forward declares, rather than defines, hashed indices. Try using
#include <boost/multi_index/hashed_index.hpp>
HTH
Joaquín M López Muñoz
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

El 17/09/2016 a las 11:11, Ram escribió:
Thanks Joaquin! That worked! I struggled the whole of yesterday. How would I find this on my own?
I don't have magical recipes, one just develops some sort of skill at cracking template-related compile errors after many years of exposure. The message [...]: error C2903: 'node_class' : symbol is neither a class template nor a function template somehow hints at node_class not existing when it should, though this is admittedly a subtle clue. PS: Please don't top post, see http://www.boost.org/community/policy.html#quoting Joaquín M López Muñoz

Thanks Joaquin anyway :) ! On Sat, Sep 17, 2016 at 3:01 PM, Joaquin M López Muñoz < joaquinlopezmunoz@gmail.com> wrote:
El 17/09/2016 a las 11:11, Ram escribió:
Thanks Joaquin! That worked! I struggled the whole of yesterday. How would I find this on my own?
I don't have magical recipes, one just develops some sort of skill at cracking template-related compile errors after many years of exposure. The message
[...]: error C2903: 'node_class' : symbol is neither a class template nor a function template
somehow hints at node_class not existing when it should, though this is admittedly a subtle clue.
PS: Please don't top post, see http://www.boost.org/community /policy.html#quoting
Joaquín M López Muñoz _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Hi Joaquin/all , I have created a boost::multi_index container for my use and it compiles successfully. I would like to add my pointer objects to it. boost::multi_index does not seem to have an insert method defined which just takes one arguement which is what I would like the container to store. Maybe I didnt understand how boost::multi_index is meant to be used. Can you please explain to me how to insert an object which I wish the store in the container defined? How is it intended to be used? The container I defined is , typedef boost::multi_index_ClassX< ClassX*, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::const_mem_fun<ParentOfClassX, Int64, &ParentOfClassX::getKey1>, boost::multi_index::const_mem_fun<ParentOfClassX, Int64, &ParentOfClassX::getKey2>,
MultiIndexedClassX;
I would like to do an equivalent of, MultiIndexedClassX sample; ClassX a; sample.insert(&a); <- Since I am interested in storing a *X and I would like it to be indexed by various parameters of X. Also please let me know how to, 1. Insert *X into the container 2. Look up by a) Value of ParentOfClassX::Key1 b) Value of ParentOfClassX::Key2 Please also let me know if I have some basic understanding wrong since I am getting confused a lot in trying to use boost::multi_index. Thanks in advance. Ram On Sat, Sep 17, 2016 at 5:29 PM, Ram <sourceopen@gmail.com> wrote:
Thanks Joaquin anyway :) !
On Sat, Sep 17, 2016 at 3:01 PM, Joaquin M López Muñoz < joaquinlopezmunoz@gmail.com> wrote:
El 17/09/2016 a las 11:11, Ram escribió:
Thanks Joaquin! That worked! I struggled the whole of yesterday. How would I find this on my own?
I don't have magical recipes, one just develops some sort of skill at cracking template-related compile errors after many years of exposure. The message
[...]: error C2903: 'node_class' : symbol is neither a class template nor a function template
somehow hints at node_class not existing when it should, though this is admittedly a subtle clue.
PS: Please don't top post, see http://www.boost.org/community /policy.html#quoting
Joaquín M López Muñoz _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Joaquin M López Muñoz
-
Ram