Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-02-24 15:06:31


----- Mensaje original -----
De: Thorsten Ottosen <thorsten.ottosen_at_[hidden]>
Fecha: Sábado, Febrero 24, 2007 7:49 pm
Asunto: Re: [boost] [Review][bimap]
Para: boost_at_[hidden]
[...]
> Anyway, I can't help think about it this way:
>
> 1. boost::bimap<T,U> is implemented in terms of Boost.MI
>
> 2. somewhere in this data-structure lies a bunch of T objects and
> U object

The internal data structure stores a bunch of objects of
type relation<T,U>. Ts and Us are not allocated separately.

> 3. upon map.insert( bimap::relation( T(), U() ) ), the T and U
> object is copied to their respective objects inside
> the datastructure

B.MI accepts an object, say x, of type relation<T,U>, as an
atomic entity, and copies it to its final destination. The
positioning of this object in both "views" of the bimap is
done according to key extractors such that

  key1(x)==x.left,
  key2(x)==x.right.

So to speak, B.MI does not know about the internal structure
of relation<T,U>: the element object is treated as an
unanalyzed entity from which keys are extracted using the
appropriate key extractors.

> If that is true, I have a hard time seing how creating a
> temporary relation() object can make a difference.

I hope the above clarifies the situation. If this is not
the case, please don't hesitate to come back to me. I know
my English is a barrier to explaning subtle concepts
clearly.

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


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