With one exception yes, i want all 3 test pass with your fix to implicit
cast.
You know, we are trying to write generic code.
Thanks!
On Sat, 27 Mar 2010 22:21:46 +0200, bearophile <[email protected]>
wrote:
Are you trying to do this?
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;
}
void test(T)() {
Vector!T v = Vector!T(0.5);
Vector!T u = v * 0.3;
writeln("u: ", u.mm);
}
void main() {
//test!float();
test!double();
//test!real();
}
Bye,
bearophile
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/