Variadic templates
Knud Sørensen
12tkvvb02 at sneakemail.com
Thu Nov 2 07:11:57 PST 2006
On Thu, 02 Nov 2006 02:02:35 -0800, Walter Bright wrote:
> 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 something like this be possible ??
tuple t=(7, 'a', 6.8);
print at t; // for print(7, 'a', 6.8)
>> 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.
Then you could write something like this.
print at func1@func2 at t; // for print(func1(func2(7, 'a', 6.8)));
More information about the Digitalmars-d
mailing list