Fastest way to check if a predicate can take a single parameter of a specific type

Per Nordlöw per.nordlow at gmail.com
Fri Oct 11 09:05:25 UTC 2019


I want to check whether

     auto _ = pred(T.init);
     static assert(is(typeof(_) == bool));

compiles or not.

Which one

     __traits(compiles, { auto _ = pred(T.init); static 
assert(is(typeof(_) == bool)); })

and

     is(typeof(pred(T.init)) == bool)

is preferred compilation performance-wise?


More information about the Digitalmars-d-learn mailing list