Choosing between __traits(compiles, { ... } ) and is(typeof( { ... } ))

Nordlöw per.nordlow at gmail.com
Wed Sep 20 12:01:21 UTC 2017


When is

     __traits(compiles, { ... } )

preferred over

     is(typeof( { ... } ))

and vice versa when writing stuff like

     enum isCopyable(S) = is(typeof( { S foo = S.init; S copy = 
foo; } ));

?

Further, are there cases where the two idioms aren't exchangable?


More information about the Digitalmars-d-learn mailing list