Le 28/03/10 10:57, so a écrit :
Well, i am having hard time explaining, it is not a surprise that you
don't understand.
To make things clearer, lets forget floats for a seconds and change your
code to standard unsigned types.


import std.stdio: writeln;

struct Vector(T) {
this(T m) { mm = m; }
Vector opBinary(string op:"*", T2)(T2 m) if(is(T2 == T)) {
return Vector(mm * m);
}
T mm;
}

Have you checked std.traits, where isIntegral!T, isFloatingPoint!T, etc. are defined? Could these, used as template constraints, solve your problem?

Reply via email to