Variadic templates

Walter Bright newshound at digitalmars.com
Thu Nov 2 11:34:43 PST 2006


nazo wrote:
> hi,
> I found some bugs.
> 
> void Foo(R...)(R r){
>   writefln(R.length);
>   writefln(r.length);
> //  R[0] t;//faild
>   typeof(r[0]) t;
>   static if(r.length>1)
>     Foo(r[1..$]);
> }
> 
> R Bar(R...)(R r){
>   return r;
> }
> 
> void main(){
>     Foo(1, 'a', 6.8);
> //    writefln(Bar(1, 'a', 6.8));//faild
> }

Tuples don't currently work as return types.



More information about the Digitalmars-d mailing list