Trait for "can be instantiated"?

Ali Çehreli acehreli at yahoo.com
Mon May 9 21:58:59 UTC 2022


On 5/9/22 14:24, Ben Jones wrote:

 > Is there a trait that can tell if you
 > can initialize a variable of a certain type?

Not answering that question but the 'is' expression seems to work in 
this case:

     static if(is (T)) {
          T value;
     }

   https://dlang.org/spec/expression.html#IsExpression

Ali



More information about the Digitalmars-d-learn mailing list