"is" expression and type tuples
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Mar 3 09:49:23 PST 2015
Jack Applegame:
>> or use recursion (with splitting in two, and not 1 + n-1).
>>
>> Bye,
>> bearophile
>
> I already have one:
>
>> template Is(ARGS...) if(ARGS.length % 2 == 0) {
>> enum N = ARGS.length/2;
>> static if(N == 1) enum Is = is(ARGS[0] : ARGS[1]);
>> else enum Is = is(ARGS[0] : ARGS[N]) && Is!(ARGS[1..N],
>> ARGS[N+1..$]);
>> }
That's 1 + n-1 :-)
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list