user defined literals
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Fri Mar 25 10:03:35 PDT 2011
On Fri, 25 Mar 2011 12:36:11 -0400, Trass3r wrote:
> 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.
Even when you compile with -O?
-Lars
More information about the Digitalmars-d
mailing list