On Saturday, 24 July 2021 at 01:44:11 UTC, Adam D Ruppe wrote:
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.

is() ... faaan-tas-tic :)

I completely forgot about the is operator and went looking all over the place for something like that.

Man ... leaving templates aside for a moment, conditional compilation alongside mixin is pretty powerful in D ! I can't believe how flexible code I am writing right now; and I am only a beginner ...

Thanks for the tip Adam !

Reply via email to