Version block "conditions" with logical operators

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Tue May 10 08:48:09 PDT 2016


On 10/05/2016 12:12, Tomer Filiba wrote:
> Alternatively, an isVersion(x) predicate that I could use in a static if
> could do the trick -- although I think ``version(x || y)`` is more
> readable than ``static if (isVersion(x) || isVersion(y))``

This is actually longer for 2 arguments, but can scale better:

import std.meta : anySatisfy;
static if (anySatisfy!(isVersion, "assert", "unittest")) ...

(There's allSatisfy for x && y).


More information about the Digitalmars-d mailing list