On Thursday 16 June 2005 05:07, Stefan Hundhammer wrote:
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.
I'm confused. Are you saying you used non-standard language features in YaST? How closely did you look at that article? It was proposing a modification to the C++ standard that would permit the overloading of "operator().*", and "operator().". Neither of which are currently overloadable in standard C++. -- Regards, Steven