std.math.sqrt(real x) && std.math.sqrt(float x) overloads
Tobias Pankrath
tobias at pankrath.net
Wed May 9 12:39:38 PDT 2012
Shouldn't this just work?
--
struct Point
{
int x, y;
Point opBinary(string op)(Point rhs)
{
return mixin("Point(x " ~ op ~ " rhs.x, y " ~ op ~ "
rhs.y)");
}
}
double dist(Point a, Point b)
{
return sqrt(abs(a.x - b.x) ^^ 2 + abs(a.y - b.y) ^^ 2);
}
Instead it's
Error: function std.math.sqrt called with argument types:
((int))
matches both:
std.math.sqrt(float x)
and:
std.math.sqrt(real x)
More information about the Digitalmars-d-learn
mailing list