On Tuesday, 10 May 2016 at 11:12:58 UTC, Tomer Filiba wrote:
Alternatively, an isVersion(x) predicate that I could use in a static if could do the trick
Well, I've come up with
template isVersion(string ver) {
mixin(format(q{
version(%s) {
enum isVersion = true;
}
else {
enum isVersion = false;
}
}, ver));
}
pragma(msg, isVersion!"foo"); // false
pragma(msg, isVersion!"assert"); // true
But it feels hackish too
-tomer
