www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Argument not match

reply Li Jie <cpunion gmail.com> writes:
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
Mar 15 2006
next sibling parent "Regan Heath" <regan netwin.co.nz> writes:
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
Mar 15 2006
prev sibling next sibling parent reply Tom <Tom_member pathlink.com> writes:
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)
This compiles fine. Not sure what you're trying to do. Tom;
Mar 16 2006
parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
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 +/
Mar 16 2006
parent Tom <Tom_member pathlink.com> writes:
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;
Mar 16 2006
prev sibling parent Ben Phillips <Ben_member pathlink.com> writes:
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
Mar 16 2006