Boost Users :
Subject: Re: [Boost-users] [multi_index and flyweight]
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
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
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 hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net