Boost Multi-index containers

The Boost Multi-index library actually provides a single generic container called multi_index_container to store your objects and options to specify one or more indexes, using which you may look up the objects. Each index will use a different criterion on potentially different fields of the object. The indexes are defined and specified as template parameters to the container and this does make the container declaration a little daunting. But, this ultimately makes the container implementation tighter with a lot of compile-time optimizations. Indeed, the hardest part of using these containers is really getting their declaration right; so let us deconstruct a declaration of such a container of PersonEntry objects:

Listing ...

Get Learning Boost C++ Libraries now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.