Check for presence of function

Adam D. Ruppe destructionator at gmail.com
Sun Mar 23 06:00:08 PDT 2014


On Sunday, 23 March 2014 at 12:57:36 UTC, Philippe Sigaud wrote:
> But this is not accepted by the grammar right now, because of 
> __traits()

That's easy enough to work around with an alias helper:

alias helper(alias T) = T;


alias isSomething(T) = alias!(__traits(compiles,
         {
            Unrelated* up;
            T.init.doSomething(up);
         }
     ));


More information about the Digitalmars-d-learn mailing list