Overloading cast

Brian digitalmars at brianguertin.com
Wed Nov 12 02:07:10 PST 2008


> I think the most elegant solution -- and this is not my idea, it has
> been mentioned here several times before -- would be to be able to use
> templates for operator overloading. Then one could write stuff like
> 
>    T opCast(T)() { ... }


except templates arent virtual, i think the simplest method is to have 
the result as an argument.
void opCast(out int result) {}



More information about the Digitalmars-d mailing list