How can I match every instance of a template type (struct)?

ag0aep6g anonymous at example.com
Tue Jul 12 14:57:38 UTC 2022


On Tuesday, 12 July 2022 at 13:56:11 UTC, rempas wrote:
> On Tuesday, 12 July 2022 at 13:37:49 UTC, ag0aep6g wrote:
>>
>> static if (is(typeof(obj) == Test!T, T)) { 
>> printf("YES!!!!!!!\n"); }
>
> Haaaaaah? Ok, what does this work anyway? I thought you needed 
> parenthesis for more than 1 templated arguments...

The second `T` is not a template argument. It's an operand of the 
"IsExpression".

You can read more about those expressions here:
https://dlang.org/spec/expression.html#is-parameter-list


More information about the Digitalmars-d-learn mailing list