static assert(version(x)) ?

Andrea Fontana nospam at example.com
Tue Nov 26 10:36:07 UTC 2019


On Tuesday, 26 November 2019 at 10:24:00 UTC, Robert M. Münch 
wrote:
> How can I write something like this to check if any of a set of 
> specific versions is used?
>
> static assert(!(version(a) | version(b) | version(c)):
>
> The problem is that I can use version(a) like a test, and the 
> symbol a is not accessbile from assert (different, 
> non-accessible namespace).

version(A) { enum isA = true; } else { enum isA = false; }
version(B) { enum isB = true; } else { enum isB = false; }

static assert(!(isA || isB));


More information about the Digitalmars-d-learn mailing list