
Matias Capeletto wrote:
Hi all,
I think we must discuss this issue together so we can settled it down.
Lets analyze the rationale step by step.
(1) Interface for the bidirectional mapping. That interface have to be compatible with existing code that work with standard maps. The best way IMHO to achieve this is that you can view the container from the two sides and see something compatible with std::map<X,Y> for the left one and with std::map<Y,X> for the right one.
(2) This force us to use first/second notation for the left view (first is the left element and second the right one) and for the right view (where the names are inverted, first is the right element and second is the left one)
I found the phrase "first/second notation" a bit confusing. Mainly becasuse is easy to mixup the notation for each view with the notation for each element in the view's value_type. You can refer to is as: "a std::pair-compatible struct is used as the value type of the left/right views".
(3) (from other thread) For bm (the above view)
As I said in another post, considering the set of relation objects as a view "from above" is a valid but nevertheless arbitrary POV. You can of course choose to see it like that, but make sure not to present it as a natural choice. Ultimately, you don't actually need to think of it as being above, or over, or along, or whatever...
a) bm can be left without any special function and so force the user to write .left or .right to refer to it. b) bm can be the same as bm.left. This IMHO introduce an asymmetry to the interface. The left view became the more important than the right view. c) bm can be used for something new. Give the user a new view of the mapping: a set of relations.
Right, and as others said I'd call it ".relations". Definitely not ".above".
The library use (c) because it is very useful to be able to insert the elements or ask for the size, etc directly. And because it allows us to extend the framework by selecting different set of relations.
So first/second are used in the side views
More precisely, to name the elements of the value_type of the side views.
and left/right in the above view.
Again, more precisely, to name the elements of the value_type of the above view. Being more precise is important in your context because you not only have left/right elements but also left/right views. Sometimes the right overload is a bit hard to pick up. Best -- ------ Fernando Cacciola SciSoft http://certuscode.wordpress.com http://fcacciola.50webs.com http://fcacciola.wordpress.com