Dlang equivalent of #define/#ifdef : not... version

Simen Kjærås simen.kjaras at gmail.com
Tue Apr 20 22:03:29 UTC 2021


On Tuesday, 20 April 2021 at 18:57:46 UTC, ichneumwn wrote:
> So my questions:
> - is there a module-crossing equivalent of "version"?

mw covered this. There's more documentation here: 
https://dlang.org/spec/version.html#version
https://dlang.org/dmd-windows.html#switch-version


> - if not, is there some way I could test for the existence of 
> the enum can_i_test_for_this? A SymbolExists!() or 
> ModuleHasSymbol!() or ModuleHasMember!() ?

__traits(hasMember, features, "i_am_not_a_feature")

This is actually what std.traits.hasMember does, but for some 
reason it can't take a module as its first argument.

--
   Simen


More information about the Digitalmars-d-learn mailing list