Compiler support for T(n) notation for initialization of variables

Joseph Rushton Wakeling via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 7 12:34:59 PDT 2014


On 07/06/14 19:57, Peter Alexander via Digitalmars-d-learn wrote:
> Well, it doesn't work in 2.065, so must be 2.066 :-)
>
> P.S. thanks for letting me know about this feature. I had no idea it was going in!

I only discovered it when I was advised to use it in a recent Phobos PR of mine. :-)

The reason I wanted to know is to check whether or not it was "safe" to use it 
in library code that might conceivably be used with earlier compilers.  I think 
requiring 2.065+ is reasonable, but requiring 2.066 obviously is not.

Oh well, (cast(T) 1) it is then. :-(

(I think that to!T will also work with a compile time constant, but it feels a 
bit dodgy to import std.conv for something like this.)


More information about the Digitalmars-d-learn mailing list