diff --git a/region.cpp b/region.cpp index 62ad34cb..5767270d 100644 --- a/region.cpp +++ b/region.cpp @@ -297,7 +297,17 @@ util::region::expanded (T mag) const return expanded (mag, mag); } -//----------------------------------------------------------------------------- + +/////////////////////////////////////////////////////////////////////////////// +template +util::region +util::region::operator+ (vector<2,T> rhs) const +{ + return { x + rhs.x, y + rhs.y, w, h }; +} + + +/////////////////////////////////////////////////////////////////////////////// template bool util::region::operator== (const region& rhs) const diff --git a/region.hpp b/region.hpp index 281d2ed5..3bf839f9 100644 --- a/region.hpp +++ b/region.hpp @@ -23,6 +23,7 @@ #include "extent.hpp" #include "point.hpp" +#include "vector.hpp" #include "types/traits.hpp" namespace util { @@ -80,6 +81,9 @@ namespace util { region& expand (T mag); region& expand (T w, T h); + // arithmetic operators + region operator+ (vector<2,T>) const; + // Logical comparison operators bool operator ==(const region& rhs) const; bool operator !=(const region& rhs) const