__traits(compiles, ...) with syntax errors

Atila Neves atila.neves at gmail.com
Tue Jan 15 11:15:21 UTC 2019


On Monday, 14 January 2019 at 21:47:40 UTC, Steven Schveighoffer 
wrote:
> How many times have you written something like:

More times than I can count...

>
> void foo(T)(T t) if (__traits(compiles, t.bar())) // or 
> is(typeof(t.bar()))
> {
>    t.bar();
> }
>
> [...]

I'm not sure how best to go about this.


More information about the Digitalmars-d mailing list