Can't RAII intersection of rectangles


Due to the interface of Rectangle <>::intersectRectangle() there is no way to use a ctor-initializer to set a member rectangle to the intersection of two rectangles.

I believe the resolution is to add a new intersectRectangle() member function which returns the resulting Rectangle, with this added behavior:

If the two rectangles do not intersect then the resulting rectangle has (x,y) equal to (this->getX(), this->getY()) and (width, height) = (0, 0)


Okay…disregard all that… I found Rectangle<>::getIntersection which does what I need. It didn’t come up because I was browsing with Intellisense and I was looking for functions starting with “intersect”