I am trying to make a templated class to accept any numeric type:class example(Type) if (isNumeric(Type)) { Type k = to!Type(1); .... }however I always get a compiler erro stating I cannot make that conversion. How do I fix it?
// phobos
import std.stdio, std.conv, std.traits;
class Example(T) if (isNumeric!T)
{
T k = to!T(1);
}
void main()
{
auto x = new Example!double();
writeln(x.k);
}
