I'm a bit green with D. I've done some basic D1 + Tango + Derelict stuff
but am keen to learn more about D2 + Phobos.
As a learning project I thought I'd like to try reading/writing data
streams from/to RS232 and/or USB devices, something I've never done
before in any language.
Can anyone gi
Dnia 31-01-2010 o 21:39:21 Ali Çehreli napisał(a):
� wrote:
Dnia 31-01-2010 o 20:59:47 Tomek Sowi�ski napisa�(a):
// specialization needed to limit matching types
void print(T:int)(T thing)
To be clear -- I did this to silence the compiler saying the call with
array matches more than one
� wrote:
Dnia 31-01-2010 o 20:59:47 Tomek Sowi�ski napisa�(a):
// specialization needed to limit matching types
void print(T:int)(T thing)
To be clear -- I did this to silence the compiler saying the call with
array matches more than one function template declaration. I'm not sure
whether
Dnia 31-01-2010 o 20:59:47 Tomek Sowiński napisał(a):
// specialization needed to limit matching types
void print(T:int)(T thing)
To be clear -- I did this to silence the compiler saying the call with
array matches more than one function template declaration. I'm not sure
whether the comp
Dnia 31-01-2010 o 19:49:44 daoryn napisał(a):
import std.stdio;
void print(T)(T thing)
{
writeln("Calling print(T)");
writeln(T.stringof);
}
void print(T:T[])(T[] things)
{
writeln("Calling print(T[])");
writeln(T.stringof);
}
void main()
{
print(3);
I haven't gotten around to templates yet, so I don't grok them quite as
well as I'd like, but it looks like DMD is having trouble deducing T
from the parameter given.
print([1,2,3]) fails to match the specialized template, even when the
general template is removed.
If you force the template
daoryn Wrote:
> According to http://digitalmars.com/d/2.0/template.html it is possible to
> specify template specialization so that DMD prefers them when instanciating
> templates, however the following code:
>
>
> -
> import std.stdio;
>
> void print(T)(T thin
According to http://digitalmars.com/d/2.0/template.html it is possible to
specify template specialization so that DMD prefers them when instanciating
templates, however the following code:
-
import std.stdio;
void print(T)(T thing)
{
writeln("Calling pri