Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-02-26 06:33:33


Matias Capeletto wrote:
> On 2/25/07, Thorsten Ottosen <thorsten.ottosen_at_[hidden]> wrote:

>>Well, the rvalue position objects created above is a good example:
>>
>>1. creare rvalue string (non-trivial) and int (trivial) arguments
>>2. copy string and int in position constructor
>>3. upon insertion, copy string and int again
>>
>>So the above takes
>>
>>1 constructor call
>>2 copy-constructor calls
>>
>>per argument, Removing 1 copy-constructor call is the goal here.
>
>
> I understand.
> The problem is bigger in the side views because another copy
> construction is taking place. From the inserted pair to relation, and
> then to the stored relation inside Boost.MultiIndex.

Oh, that's bad. Another consequence of not using the same underlying
pair type.

> I think I can change the current implementation to avoid the first
> conversion if the compiler support the mutant_relation (you can read
> about this in the rationale), because a reinterpret_cast can be used
> to convert between bimap pairs and relation.

I'm somewhat uncomfortable about this casting. Is it provable legal by
the standard? (What works fine for pair<int,int>, might crash for
pair<Foo,Bar>.)

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk