|
Boost : |
Subject: Re: [boost] Feed pointers to a container, however use the member of the data type which pointer refer to
From: joaquin_at_[hidden]
Date: 2009-09-22 03:06:10
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#advanced_key_extractors
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk