how to test (at compilation-time) for existence of an already-declared object ?

Adam D Ruppe destructionator at gmail.com
Sat Jul 24 01:44:11 UTC 2021


On Saturday, 24 July 2021 at 01:29:26 UTC, someone wrote:
> Suppose I have a module with the following:


static if(is(classTickerCustomNYSE))
    // it was a valid type
else
   // it was not a valid type


can use that to test. you can also mix in the name


static if(is(mixin("class name here"))) {}



There's similar tricks for testing for imports and such too but i 
recommend here you import the module first then can test it.


More information about the Digitalmars-d-learn mailing list