Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
March 16, 2006 Argument not match | ||||
---|---|---|---|---|
| ||||
CODE: ------------------------- template Test(T) { void Test(char[] name, T value) { writefln("Test"); } } // in main Test("hello", 5); ------------------------- Compile it, I get some errors: main.d(73): template main.Test(T) does not match any template declaration main.d(73): template main.Test(T) cannot deduce template function from argument types (char[5],int) Does not support this? and... Can I subscibe this news group? my network speed is very slowly for this site. Thanks, - Li Jie |
March 16, 2006 OT: newsgroup | ||||
---|---|---|---|---|
| ||||
Posted in reply to Li Jie | On Thu, 16 Mar 2006 04:01:07 +0000 (UTC), Li Jie <cpunion@gmail.com> wrote:
> and... Can I subscibe this news group? my network speed is very slowly for this site.
Yes, just point your news client at digitalmars.com on the usual port 119, and you can get a list of groups containing digitalmars.D etc.
Regan
|
March 16, 2006 Re: Argument not match | ||||
---|---|---|---|---|
| ||||
Posted in reply to Li Jie | In article <dvanu3$1krf$1@digitaldaemon.com>, Li Jie says... > >CODE: >------------------------- >template Test(T) >{ >void Test(char[] name, T value) >{ >writefln("Test"); >} >} > >// in main >Test("hello", 5); >------------------------- > >Compile it, I get some errors: >main.d(73): template main.Test(T) does not match any template declaration >main.d(73): template main.Test(T) cannot deduce template function from argument >types (char[5],int) # import std.stdio; # # template Test(T) # { # void Test(char[] name, T value) # { # writefln("Test"); # } # } # # int main() # { # Test!(int)("hello", 5); # # return 0; # } This compiles fine. Not sure what you're trying to do. Tom; |
March 16, 2006 Re: Argument not match | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom | Tom wrote: > This compiles fine. Not sure what you're trying to do. Apparently, he was trying to use implicit template instantiation which doesn't want to work in the example he posted. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/ |
March 16, 2006 Re: Argument not match | ||||
---|---|---|---|---|
| ||||
Posted in reply to Li Jie | While this is sure to get fixed in future versions of D, the current ITI implementation is not perfect. You either have to full write out the template Test!(int)("hello", 5) or rearrange the argument of Test to void Test(T value, char[] name) *The last example should work, but I haven't tried it. In article <dvanu3$1krf$1@digitaldaemon.com>, Li Jie says... > >CODE: >------------------------- >template Test(T) >{ >void Test(char[] name, T value) >{ >writefln("Test"); >} >} > >// in main >Test("hello", 5); >------------------------- > >Compile it, I get some errors: >main.d(73): template main.Test(T) does not match any template declaration >main.d(73): template main.Test(T) cannot deduce template function from argument >types (char[5],int) > >Does not support this? > > >and... Can I subscibe this news group? my network speed is very slowly for this site. > > > >Thanks, > >- Li Jie > > |
March 16, 2006 Re: Argument not match | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom S | In article <dvbrhb$rp$1@digitaldaemon.com>, Tom S says... > >Tom wrote: >> This compiles fine. Not sure what you're trying to do. > >Apparently, he was trying to use implicit template instantiation which doesn't want to work in the example he posted. Silly me. Tom; |
Copyright © 1999-2021 by the D Language Foundation