Best way of checking for a templated function instantiation

Arafel via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 10 06:57:54 PDT 2016


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!\"+\"")


More information about the Digitalmars-d-learn mailing list