std.typecons.Ref(T).opImplicitCastTo()

Jonathan M Davis jmdavisProg at gmx.com
Sun Apr 1 21:30:14 PDT 2012


On Monday, April 02, 2012 15:36:01 James Miller wrote:
> On 31 March 2012 06:28, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> > it also has
> > opDot, which is being removed from the language.
> 
> Out of curiosity, what was opDot?

An overload of the dot operator. So, if you had

A a = foo();
a.func();

and A implemented opDot, instead of A's func being called, the overloaded 
opDot would be called. I don't know exactly how it was implemented. It's 
either a D1-only thing or an early D2 thing, but I've never used it, and it's 
not supposed to be in the language anymore (though like a number of other 
features that are supposed to be gone, it may not have actually have been 
deprecated yet).

It's probably similar to how -> is overloadable in C++, which can then be 
useful for stuff like smart pointer types so that they can forward function 
calls to the object pointed to by the smart pointer.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list