mirror of https://github.com/buggins/dlangui.git
types.d from upstream
This commit is contained in:
parent
da5b87c418
commit
fe53b78ba3
|
@ -50,12 +50,18 @@ struct Point {
|
|||
int x;
|
||||
int y;
|
||||
|
||||
Point opBinary(string op)(Point v) if (op == "+") {
|
||||
Point opBinary(string op)(Point v) const if (op == "+") {
|
||||
return Point(x + v.x, y + v.y);
|
||||
}
|
||||
Point opBinary(string op)(Point v) if (op == "-") {
|
||||
Point opBinary(string op)(int n) const if (op == "*") {
|
||||
return Point(x * n, y * n);
|
||||
}
|
||||
Point opBinary(string op)(Point v) const if (op == "-") {
|
||||
return Point(x - v.x, y - v.y);
|
||||
}
|
||||
Point opUnary(string op)() const if (op == "-") {
|
||||
return Point(-x, -y);
|
||||
}
|
||||
int opCmp(ref const Point b) const {
|
||||
if (x == b.x) return y - b.y;
|
||||
return x - b.x;
|
||||
|
|
Loading…
Reference in New Issue