user defined literals

Trass3r un at known.com
Fri Mar 25 09:36:11 PDT 2011


Lars T. Kyllingstad Wrote:
>   enum I = Complex!float(0, 1);
>   auto z = 5.0 + 3*I;
> 
> The compiler should be able to fold the sum into a single constant at 
> compile time.

It is indeed capable of doing that :)
But it only does it if you force it to (e.g. via enum z).
With auto it will perform 2 opBinaryRight calls at runtime.


More information about the Digitalmars-d mailing list