Add subtration operation for points

This commit is contained in:
Danny Robson 2011-09-13 16:49:10 +10:00
parent ee1439e5fc
commit dd1a935ed4
2 changed files with 6 additions and 0 deletions

View File

@ -59,6 +59,11 @@ point::operator+= (const point &rhs) {
}
point
point::operator- (const point &rhs) const
{ return point (x - rhs.x, y - rhs.y); }
std::ostream&
operator<< (std::ostream &os, const point &p) {
os << "point(" << p.x << ", " << p.y << ", " << p.z << ")";

View File

@ -33,6 +33,7 @@ namespace util {
double manhattan (const point &) const;
point& operator+= (const point&);
point operator- (const point&) const;
};
}