A request: templated opCast() signature for class/struct

Walter Bright newshound at digitalmars.com
Sat Feb 17 21:13:10 PST 2007


Pragma wrote:
> The problem, for the uninitiated, is that D cannot overload by return 
> type.

I think I understand the problem, and what you're trying to do. The 
problem is that T opCast(T)() wouldn't operate like anything else in D, 
it would be a total hack. I don't know what the right answer is here, 
we'll just have to work on it.

There are currently no user defined implicit casts, though Andrei has 
suggested adding them with something like opImplicitCast().



More information about the Digitalmars-d mailing list