"is" expression and type tuples

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 3 08:42:21 PST 2015


Jack Applegame:

> Seems like "is" expression doesn't support type tuples:
>
>> pragma(msg, is(short : int));                 // true
>>
>> enum Test(ARGS...) = is(ARGS[0..2] : ARGS[2..4]);
>> pragma(msg, is(Test!(int, int, int, int)));   // false
>> pragma(msg, Test!(int, short, int, int));     // false
>
> Is it by design, or just not implemented?

It's by design, perhaps because Walter didn't think of this case, 
or probably for compiler simplicity. But it should be not too 
much hard to implement it your code. Just use two is(), or use 
recursion (with splitting in two, and not 1 + n-1).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list