On Dec 25, 2007 1:16 PM,
merry xmas everyone,
and maybe santa claus or anyone of you have a helping surprise for me :o)
after became acquainted with boost and boost.python i have to learn boost.multi_index now. the goal is to build a 'map' with two individual keys (a name and an identifier) per value (object of user class); nme1-idf1-valu1, nme2-idf2-valu2, nme3-idf3-valu3, ... any value should be 'directly' accessible by name or by identifier; valu1:=map[nme1], valu1:=map[idf1]. although i don't understand the documentation perfectly and i'm not familiar with templates i recognise that boost.multi_index is the perfect way :o) and i did the following:
<snip> Code And Problem </snip>
how to encapsulate this special multi_index into a class, that fits the above description of the needed 'map'. are there possibilities to avoid the 'std::string' for the 'name' key? where are the more easier examples for C++-templates/boost newbies like me :o) ?
You can definitely use Boost.MultiIndex to solve your problem. The
thing is that a bidirectional map (a map where you can search in both
ends) is a very common data structure, so a new library called
Boost.Bimap was build on top of Boost.MultiIndex to give you a nicer
interface that plays nicely with standard maps.
In the most simple form you will use it like:
#include