Article on Tuples

Sean Kelly sean at f4.ca
Wed Nov 15 19:06:12 PST 2006


Walter Bright wrote:
> Sean Kelly wrote:
>> Walter Bright wrote:
>>> Russ Lewis wrote:
>>>> Walter Bright wrote:
>>>>> http://www.digitalmars.com/d/tuple.html
>>>>
>>>> The one thing I didn't get was why there was two versions of the 
>>>> "Curry" template, one with a "Dummy" parameter.  Can you explain?  
>>>> And then can you post the explanation on that page?
>>>
>>> It's because you cannot overload two templates with the same 
>>> parameter list. So we make them different by giving one a dummy 
>>> parameter.
>>
>> Just to be clear, this limitation will eventually go away, correct?
> 
> Maybe.

Ack! Related question :-)  I assume this will work at some point?:

   T fn( T, U )( U val )
   {
       return T.init;
   }

   void main()
   {
       int i = fn!(int)( 1.0 );
   }

Currently, I get:

   test.d(9): template instance fn!(int) does not match any template 
declaration
   test.d(9): Error: template instance 'fn!(int)' is not a variable
   test.d(9): Error: function expected before (), not fn!(int) of type int


Sean



More information about the Digitalmars-d-announce mailing list