Boost logo

Boost Users :

Subject: Re: [Boost-users] [multi_index and flyweight]
From: joaquin_at_[hidden]
Date: 2009-12-09 02:11:26

Samuel Charron escribió:
> On Tue, Dec 8, 2009 at 9:01 PM, Joaquin M Lopez Munoz
> <joaquin_at_[hidden]> wrote:
>> Ok, now I got it. The short ansewer is that Boost.MultiIndex
>> does not provide any off-the-shelf way to do what you want,
>> basically because each element (each vector in your case)
>> appears exactly once in any given index.
>> Long answer: you can approach your scenario by storing
>> "container positions" rather than containers and manually
>> inserting for each new conainer as many different positions
>> as elements has the container. Kind of as sketched in the
>> following program:
>> <code snippet>
>> Is this what you're after?
>> Joaquín M López Muñoz
>> Telefónica, Investigación y Desarrollo
> Yes that's it.
> I tried something similar, using boost::flyweight (hence my question
> about scoped flyweights).
> I tried to write another kind of index for BMI some time ago, and
> if I remember correctly, there is no way to map an element to
> multiple values of an index. Do you think of anything to point into
> the code of BMI to try doing it ?

I don't think BMI can be tweaked in that way. The idea that each element
is mapped
exactly once into each index is a fundamental one in the design of the

> Do you have any kind of documentation about writing an index for BMI
> (to be sure what I'm writing is safe) ?

No, I'm afraid I don't. If you plan on writing a custom index of your own
do not hesitate to come back for help. Others have done in the past, it's
not particularly difficult if you take one of the current indices as
your starting
point. Anyway, I doubt there's a nice way to implement your multiple-value

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at