
Hi, please refer to the name of the lib your post's about in the post's subject line, like this: [multi_index]. 路 邓 escribió:
Dear All:
In the following codes, I feed the container with B*, however I user the member of B as the index. Can somebody explain to me how this work out? And It seems that if smart pointers are feeded into the container, it still works out.
[...]
typedef boost::multi_index_container< B*, indexed_by< ordered_unique< BOOST_MULTI_INDEX_MEMBER(B, int, idx) > >
Container;
Yep, this is a feature provided by Boost.MultiIndex predefined key extractors to help users dealing with pointers and pointer-like elements, as explained in http://www.boost.org/libs/multi_index/doc/tutorial/key_extraction.html#advan... What's your particular concenr about this? Are you just puzzled that this works out of the box, or are you interested in the internal mechanisms used to implement the feature? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo