Testing whether static foreach is available

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 9 09:53:19 PDT 2017


On Saturday, 9 September 2017 at 16:30:51 UTC, Jean-Louis Leroy 
wrote:
>
> Also, is it possible to conditionally compile depending on the 
> compiler's version, not only the compiler (I mean, not compile 
> a block if it's GDC version 5.4.1 or lower)?

What you really need is a version statement based on the version 
of the D language, not the version of DMD or LDC or GDC per se.

Something like

version(DLANGSEMVER >= 2.076.0)
{
    //include static foreach code.
}

but we can't do conditionals in version blocks, so you'd need a 
static if. Alternately, we'd also need a trait or something to 
get the semver of the compiler.



More information about the Digitalmars-d mailing list