Re: [boost] [Boost-users] Fwd: [bimap] Review of the Bimap library begins today Feb 15

On 2/20/07, Jean-Christophe Roux <jcxxr@yahoo.com> 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; tm.one[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 framework 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

bimap<X,Y> bm; bm.left // --> map<X,Y> : X first, Y second bm.right // --> map<Y,X> : Y first, X second
You may want to consider the nomenclature "forward" and "reverse" - for directories, this is the standard way of referring to, for example, look-up of a telephone number from a name and look-up of a name from a telephone number, respectively. Reverse also indicates that the order of the template arguments are reversed in that case relative to the order in which they are declared. Matthias

On 2/20/07, Matthias Schabel <boost@schabel-family.org> wrote:
bimap<X,Y> bm; bm.left // --> map<X,Y> : X first, Y second bm.right // --> map<Y,X> : Y first, X second
You may want to consider the nomenclature "forward" and "reverse" - for directories, this is the standard way of referring to, for example, look-up of a telephone number from a name and look-up of a name from a telephone number, respectively. Reverse also indicates that the order of the template arguments are reversed in that case relative to the order in which they are declared.
Yes, it can be considered. Joaquin in his original bimap use to/from, that was another possibility. The good thing about left/right is that it can be used in the naming of the relation too. So we keep the number of new words to learn. Other strong point is that left and right are smaller than forward and reverse. But again, the idea is to use words that express the symmetry of the bidirectional mapping. The left and right views are equally important. Regards Matias
participants (2)
-
Matias Capeletto
-
Matthias Schabel