Templates array detection
Cube
sq at ua.re
Wed Dec 12 02:58:33 PST 2012
Hi,
I'm having a problem getting templates to work correctly.
I want to handle arrays differently, but when I try to compile
the following example code it says it matches more than 1
template. What is the correct way to do this?
--
void main()
{
foo(1);
foo([1,1]);
}
void foo(T)(T t)
{
writeln(t);
}
void foo(T)(T[] t)
{
for(int i = 0; i < t.length; i++)
writeln(t[i]);
}
--
More information about the Digitalmars-d-learn
mailing list