Why can't templates use tuples for for argument types?
Jari-Matti Mäkelä
jmjmak at utu.fi.invalid
Mon Jul 16 22:43:21 PDT 2007
BCS wrote:
> Reply to Jari-Matti Mäkelä,
>
>> Probably because the compiler does not unfold the tuple. I've filed a
>> bug about instantiating an array literal from a tuple. It has a
>> similar problem:
>>
>> alias Tuple!(1,2,3) a;
>>
>> int[] foo = [ a ]; // does not work, but
>> int[] foo = [ a[0], a[1], a[2] ]; // does
>
> So you are saying it's a bug?
>
> In that case, what is the bug number so I can add some more comments?
I think the first class tuples -bug covers this too:
http://d.puremagic.com/issues/show_bug.cgi?id=1293
If you feel it's worth a new bug report, please do as you wish.
I have to admit the situation is a bit unorthogonal - for example these work
too:
alias Tuple(int,int) a;
void foo(a b) {}
void bar() { a b; }
But
template baz(a b) {}
doesn't.
More information about the Digitalmars-d-learn
mailing list