Variadic templates

Walter Bright newshound at digitalmars.com
Thu Nov 2 02:02:35 PST 2006


Oskar Linde wrote:
>> There's a lot of unexplored territory with the tuples, they should be
>> able to do a lot more than the current rather limited ability.
> I am really excited about the possibilities here. Will tuples become real
> types or a meta-types?

My current thought is that they will never be types, i.e. you will not 
be able to have a "pointer to tuple" or "array of tuples". Also, they 
will always be statically fixed at compile time. A tuple will simply be 
a shorthand notation for a sequence of types or expressions.

> From the examples you show, I'd presume there is an implicit tuple expansion
> when calling
> 
> void foo(int a, int b) {}
> 
> as foo(t); where t is a tuple of (int,int) ?

That's right. Those two declarations are the same thing. A function 
parameter list is a tuple.

> will it be possible to declare a function such as taking a specific tuple
> argument

I'm not sure what you mean. A function's parameter types *are* a tuple.

> and use tuples as return values etc?

That's something I want to make work.



More information about the Digitalmars-d mailing list