
Joel de Guzman wrote:
Steven Watanabe wrote:
AMDG
Simonson, Lucanus J <lucanus.j.simonson <at> intel.com> writes:
I tried to explain that non-member, non-friend functions were supposed to be the way to go with the first revision of the library, and they overruled me. In the end I agreed with them that having objects that fully encapsulate the behavior of geometry types is nicer and worth some effort, maybe even make a tradeoff or two to get it.
Using free functions and ADL can be dangerous since there is always the chance of accidentally picking up a function that means something totally different.
Yeah ADL is bad.
Traits don't have this limitation. In some ways this is like creating an adapter as you are doing. The difference is that the adaptation layer operates on any instance of the adapted type rather than on one stored inside it.
Traits, however, have the tendency to become "metafunction blobs" that are cumbersome to use in TMP if you don't do it right.
There are a couple of ways to get around these problems (both ADL and metafunction blobs).
Anyway... "How Non-Member Functions Improve Encapsulation" -Scott Meyers http://www.ddj.com/cpp/184401197 Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net