On Tuesday, August 26, 2003, at 10:05 AM, Jaakko Jarvi wrote:
In our last exciting episode Stephen Love wrote:
operator-> *is* overloadable.
It is, but not freely. The return type cannot be arbitrary, say a lambda_functor type, making it not very useful for the LL.
Specifically, the right side of "->" must be the NAME of a class' member or member function. It cannot be any kind of actual object (including pointers-to-member). This restricts the left side to: 1. A pointer to a (class/struct/union) data object (conventional C usage) 2. A class object with an "operator ->()" that returns a pointer to a data object 3. A class object with an "operator ->()" that returns an object that follows rules [2] or [3]. No matter what, "operator ->()" eventually leads to the standard C usage. All you can do is delay the event and build proxy objects to obtain the data. Daryle