|
Boost Users : |
Subject: Re: [Boost-users] multi_index_container for composite key
From: joaquin_at_[hidden]
Date: 2010-09-09 03:00:52
Uthpal Urubail escribió:
> Joaquín M López Muñoz,
> Thanks for offering me the help.
>
You're welcome. Please don't top-post and try to follow the
general discussion policies outlined at
http://www.boost.org/community/policy.html
> One interesting observation:
> If I use the below in finding the objects it is not retrieving properly
> indexed_by<
> ordered_unique< /// INSTEAD if I use ordered_non_unique< it works fine
> composite_key<
>
If you use ordered_unique then there cannot be two elements with the same
node[0], node[1], node[2] values. I guess this is what's happening in
your case.
> I am still not clear with my question:2
> Can I define the container like below?
> I don't want to create the temporary data structure. I will get these information from a class object. Can I use them directly??
> Please help me in understanding.
>
> typedef multi_index_container<
> <pointer???>, //??
> indexed_by<
> ordered_unique<
> composite_key<
> <pointer????>, //???
> BookNodeExtractor<0>,
> BookNodeExtractor<1>,
> BookNodeExtractor<2>
> >
> >,
> ordered_unique<
> member<classname,size_t,&classname::id>
> >
> >
> > beambook;
>
I'm not sure what your question is, but if you wonder whether you can
define a container of pointers to Books rather than Book objects proper,
the answer is: you can, but you have to modify BookNodeExtractor so
that it accepts pointers rather than Book &s.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net