[Boost.MultiIndex] docs unclear for ey extractors
Hi!
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
employee_set;
takes care of all what I need even without it - or do I have to define the struct to make this work? Markus
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
> > 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_extracti... Does it read better now? Best, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
Joaquín Mª López Muñoz
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?
Much better! Thank you for making this clear. BTW: The docs for multiindex are of very high quality elsewhere. Did you produce them with quickbook? Then I'd like to see the source as example of how docs should be ... Thankx, Markus
Markus Werle ha escrito: [...]
BTW: The docs for multiindex are of very high quality elsewhere. Did you produce them with quickbook? Then I'd like to see the source as example of how docs should be ...
The docs are written by hand, I work directly with the HTML source, except for producing the highlighted C++, which is done with a little UI utility derived from Joel de Guzman's Boost.Spirit-based cpp_to_html (*) I plan to move to QuickBook in Boost 1.35, though. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo (*) If you're interested in this utility, drop me a private email and I'll send it to you.
participants (2)
-
Joaquín Mª López Muñoz
-
Markus Werle