On Wednesday 15 June 2005 23:42, Steven T. Hatton wrote:
This was recently posted to comp.std.c++, and looks interesting:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1671.pdf
Overloading operator.() & operator.*() ... With operator->() and operator->*() a designer of a class can create a smart pointer.
We've been doing that for the YaST2 internal libraries for 5+ years (YCPValue
and derived classes, YCPValueRep and derived classes).
My personal experience is that this tends to confuse people - you never know
when to use "obj.something()" and when to use "obj->something()", much less
when to use "const & SomeClass" rather than simply "SomeClass" for function
parameters. It obscures what is really going on, and it encourages people to
do the wrong thing.
I would avoid it for future projects.
CU
--
Stefan Hundhammer