How can I match every instance of a template type (struct)?

Ali Çehreli acehreli at yahoo.com
Tue Jul 12 15:30:03 UTC 2022


On 7/12/22 06:34, rempas wrote:

 >    static if (is(typeof(obj) == Test)) { printf("YES!!!!!!!\n"); }

An alternative:

   import std.traits;
   static if (isInstanceOf!(Test, typeof(obj))) { printf("YES!!!!!!!\n"); }

https://dlang.org/phobos/std_traits.html#isInstanceOf

Ali



More information about the Digitalmars-d-learn mailing list