On Monday, 9 May 2022 at 21:58:59 UTC, Ali Çehreli wrote:
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
Using is(T) instead of isType!T also appears to be true for the un-instantiate-able enum. Was your point just that I could replace isType!T with is(T)?