Article on Tuples (Patch)

Oskar Linde oskar.lindeREM at OVEgmail.com
Fri Dec 1 06:18:55 PST 2006


Sean Kelly wrote:
> Bill Baxter wrote:
>> Bummer, that doesn't seem to work inside a class member template:
>>
>> class Foo {
>>     template myCast(T) {
>>         T myCast(U)(U val) {
>>             return cast(T) val;
>>         }
>>     }
>> }
>>
>> void main() {
>>   Foo foo = new Foo;
>>   int i = foo.myCast!(int)(1.0);
>> }
>>
>> -->
>> Error: function expected before (), not 'foo dotexp template myCast(U)'
> 
> Hopefully, this is just a bug.  If it can be made to work I don't see a 
> pressing need for partial template argument evaluation.

Attached is a small and ugly patch that should resolve this. I don't 
have a proper regression testing framework running, so it is quite the 
opposite of extensively tested and should be written much more properly. 
It just serves to illustrate that this is definitely fixable.

/Oskar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dmd-nestmemifti.patch
Type: text/x-patch
Size: 870 bytes
Desc: not available
Url : http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20061201/1049ba13/attachment.bin 


More information about the Digitalmars-d-announce mailing list