Compare TypeTuple element with another type
Tudor Berariu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 1 05:07:14 PDT 2014
On Friday, 1 August 2014 at 11:39:27 UTC, John Colvin wrote:
> On Friday, 1 August 2014 at 10:25:39 UTC, Tudor Berariu wrote:
>> Is it possible to compare at compile time an element from a
>> TypeTuple with another type?
>>
>> This code fails:
>>
>> alias T = Tuple!(int, bool);
>> static assert(is(T[0] == int));
>>
>>
>> Error: static assert (is(Tuple!(int, bool)[0] == int)) is
>> false
>>
>>
>> Tudor
>
> alias T = TypeTuple!(int, bool);
> static assert(is(T[0] == int));
>
> or
>
> alias T = Tuple!(int, bool);
> static assert(is(typeof(T.expand)[0] == int));
Thanks.
More information about the Digitalmars-d
mailing list