Comparing Two Type Tuples
Simen kjaeraas
simen.kjaras at gmail.com
Sun Apr 4 17:12:22 PDT 2010
Simen kjaeraas <simen.kjaras at gmail.com> wrote:
> Daniel Ribeiro Maciel <danielmaciel at gmail.com> wrote:
>
>> Heya ppl!
>>
>> I was wondering how could I write a function that takes two Type
>> Tuples as arguments and returns true if they are match.
>>
>> Could anyone help me with this?
>>
>> Thanks!
>
> This should work, but doesn't (filing a bugzilla about it now):
>
> template compareTuple( T... ) {
> template compareTuple( U... ) {
> enum bool compareTuple = is( T == U );
> }
> }
>
> static assert( compareTuple!( int, float )!( int, float ) );
>
> However, this works:
>
> alias compareTuple!( int, float ) foo;
> static assert( foo!( int, float ) );
>
There.
http://d.puremagic.com/issues/show_bug.cgi?id=4061
--
Simen
More information about the Digitalmars-d-learn
mailing list