Templated structs / variant values

Marek Janukowicz marek at janukowicz.net
Tue Aug 20 08:47:34 PDT 2013


Dicebot wrote:

> On Tuesday, 20 August 2013 at 11:22:35 UTC, Marek Janukowicz
> wrote:
>>> if(is(type == Setting!U, U...))
>>
>> This is not enough for me - I have many instantiations of
>> Setting struct
>> template and I need all of them, regardless of parameters they
>> were
>> instantiated with.
> 
> Have you actually tried this snippet? It does exactly that.
> "U..." is a pattern for variadic template argument list.
> Constraint will match Setting instance with any number of any
> template arguments.

Yeah, that was a typical PEBKAC. I somehow assumed you use U, U... as dummy 
placeholders :) even that I know this syntax. Anyway, this works as 
expected, so thank you very much (and all the other that contributed).

-- 
Marek Janukowicz


More information about the Digitalmars-d-learn mailing list