Boost logo

Boost Users :

From: Charles Tolman (ct_at_[hidden])
Date: 2006-12-19 11:20:04


Hi, Boost newbie question regarding indexing of multi_index_containers.

First a great big thank you to Joaquín M López Muñoz for sorting this library
out. Lovely job.

OK I have a question about indexing. Probably one for Joaquin.

I have a structure that can be indexed on the following keys:
0: identity -- unique - this is fine.
1: int position; -- non_unique - this is fine.
2: int priority; -- non_unique - this is also fine.
3: vector<MyStringType> -- non_unique - but NOT fine.

So number 3 is the problem. Am I right in thinking that the
multi_index_container does not handle this case? i.e. where you would want a
given SINGLE element to be indexed on a variable (unknown) number of keys, in
this case as many strings as are in the vector.

Although strictly they are not actually separate keys, there is just one
non-unique key, but a given element can have multiple instances for this one key.

Of course I can workaround this by having another structure to handle this or
alternatively wrap up the element a multiple number of times, as many as
required by the length of the vector of strings. But I was wondering if there
are any ways of handling this in the basic library.

Apologies if I have missed something and it is in an FAQ somewhere, although I
have done an initial search.

TIA
Charles Tolman


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