Boost logo

Boost Users :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-10-26 09:40:16


Markus Werle ha escrito:

> Hi!
>

Hello Markus,

> In
> http://boost.org/libs/multi_index/doc/advanced_topics.html
> #advanced_key_extractors
> I do not understand how the struct name_extractor comes to use
> and why I have to define it. IIUC the code snippet
> --------------------------------
> typedef multi_index_container<
> employee *,
> indexed_by<
> ordered_non_unique<member<employee,std::string,&employee::name> > >
> > employee_set;
> --------------------------------
> takes care of all what I need even without it - or do I have
> to define the struct to make this work?

This part of the docs is admittedly somewhat confusing. What it tries
to convey is that:

1. The concept of key extractor allows for one extractor to work on
different types (e.g. the base type and pointers to this), like exemplified

by name_extractor.
2. Predefined key extractors take advantage of this circumstance and
let you work with pointers and references seamlessly.

So, name_extractor just shows how a key extractor can be made
to work "polymorphically", but its usage is not exercised at the docs.

This is not the first time someone gets puzzled about this particular
section, so I tried to improve the docs shipping with Boost 1.34.
Please take a look at the new version at:

http://boost-consulting.com/boost/libs/multi_index/doc/tutorial/key_extraction.html#advanced_key_extractors

Does it read better now?

Best,

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