Boost logo

Boost :

From: Matias Capeletto (matias.capeletto_at_[hidden])
Date: 2007-02-20 07:20:46

On 2/20/07, Jean-Christophe Roux <jcxxr_at_[hidden]> wrote:
> Hello,
> > 1) The new notation left/right used instead of first/second.
> I am wondering if left/right will scale well. Isn't it reasonable to
> anticipate that the library could evolve into trimap, quadrimap and so
> on? Left/center/right could work for trimap but it becomes harder to
> find names for quadrimaps? Maybe going with one/two instead would be
> better.

The framework is about *bidirectional* mapping. This restriction
allows us to build a very intuitive interface that extend the stl
mapping framework.
A bimap is a very frequent beast, so it is worth to have a special
design for it.
Trimaps and quadrimaps are less frequent.
With trimaps you have to make a lot of changes to the interface.
The operator[] will lost their meaning.
trimap<X,Y,Z> tm;[x] = ??
And the most important thing is that when you are viewing one of the
sides you can not provide the symmetric behaviour of the actual

bimap<X,Y> bm;
bm.left // --> map<X,Y> : X first, Y second
bm.right // --> map<Y,X> : Y first, X second

For a general N-map framework the best approach is to use Boost.MultiIndex.

Best Regards
Matias Capeletto

Boost list run by bdawes at, gregod at, cpdaniel at, john at