Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!apple.com!wrl From: wrl@apple.com (Wayne Loofbourrow) Newsgroups: comp.lang.c++ Subject: Proposed extension ++@ , @++ Message-ID: <4684@internal.Apple.COM> Date: 11 Oct 89 23:27:34 GMT Sender: usenet@Apple.COM Organization: Apple Computer, Inc. Lines: 45 The following is a proposed extension to operator overloading of operator++ and operator-- : In current C++, it is possible to overload operator ++. However, it is not possible to make a distinction between prefix and postfix usage. This leads to an inability to create user-defined types that behave just like built in types. How about allowing declarations of the form: class complex { // ... public: // ... complex operator ++@ (); // prefix ++ operator complex operator @++ (); // postfix ++ operator }; complex complex::operator ++@() { *this = *this + 1; return *this; } complex complex::operator @++() { complex c = *this; *this = *this + 1; return c; } For compatibility with current C++, defining the operator++ function would be equivalent to defining both operator ++@ and operator @++ identically. This should allow all current C++ code to work just fine and also allow further discrimination when it is desired. The same extension would apply to operator-- . What do people think? Wayne Loofbourrow Advanced Technology Group Apple Computer, Inc. Internet: wrl@apple.com