Rect: Comment about a bad API method.

In retrospect, I don't like Rect + Rect = union -- it doesn't make as much sense and isn't as readable as Rect.union(Rect).
This commit is contained in:
Jared Boone 2016-09-07 22:19:30 -07:00
parent f722497b01
commit df0fc30fda

View File

@ -42,6 +42,8 @@ Rect Rect::intersect(const Rect& o) const {
} }
} }
// TODO: This violates the principle of least surprise!
// This does a union, but that might not be obvious from "+=" syntax.
Rect& Rect::operator+=(const Rect& p) { Rect& Rect::operator+=(const Rect& p) {
if( is_empty() ) { if( is_empty() ) {
*this = p; *this = p;