On Wednesday, 10 August 2016 at 13:57:54 UTC, Arafel wrote:
On Wednesday, 10 August 2016 at 13:40:30 UTC, Meta wrote:
On Wednesday, 10 August 2016 at 13:37:47 UTC, Meta wrote:
static assert(__traits(compiles, auto _ =
S.init.opBinary!"+"(int.init));
Made a typo, this should be:
static assert(__traits(compiles, { auto _ =
S.init.opBinary!"+"(int.init); }));
Hi!
Thanks, that would do! Just out of curiosity, would there be
any way to check just that the function is defined, like what
"hasMember" would do, without caring about argument number,
types, etc.? Ideally something like:
__traits(hasMember, S, "opBinary!\"+\"")
Unfortunately you're stuck using __traits(compiles) as
`opBinary!"+"` is not a symbol.
static assert(__traits(compiles, { alias _ = S.opBinary!"+"; }));