Testing whether static foreach is available

via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 10 03:43:24 PDT 2017


On Sunday, 10 September 2017 at 02:13:58 UTC, jmh530 wrote:
> On Sunday, 10 September 2017 at 01:49:42 UTC, Mike Parker wrote:
>>
>> But Adam's point about the false branch still holds, so:
>>
>> static if(__VERSION__ >= 2076)
>>     mixin(`static foreach(i; 0..3) writeln(i);`);
>> else
>>     writeln("Version too low");
>>
>> The same is true for version statements.
>
> But it would work for changes to phobos, right? So there's a 
> silver lining ;)

Since Phobos always uses the latest compiler frontend, there's 
nothing to check ;)


More information about the Digitalmars-d mailing list