Variadic templates

Bruno Medeiros brunodomedeiros+spam at com.gmail
Sun Nov 5 06:30:31 PST 2006


Walter Bright wrote:
> 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.

.. nor could they as they are not types in the first place.

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list