From 0a153e8e1243ed31203588c2f52669b9c77b1dd4 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 20 Feb 2015 16:06:46 +1100 Subject: [PATCH] region: add vector subtraction operator --- region.cpp | 9 +++++++++ region.hpp | 1 + 2 files changed, 10 insertions(+) diff --git a/region.cpp b/region.cpp index 5767270d..edba9e54 100644 --- a/region.cpp +++ b/region.cpp @@ -307,6 +307,15 @@ util::region::operator+ (vector<2,T> rhs) const } +//----------------------------------------------------------------------------- +template +util::region +util::region::operator- (vector<2,T> rhs) const +{ + return { x - rhs.x, y - rhs.y, w, h }; +} + + /////////////////////////////////////////////////////////////////////////////// template bool diff --git a/region.hpp b/region.hpp index 3bf839f9..ffdbcfdf 100644 --- a/region.hpp +++ b/region.hpp @@ -83,6 +83,7 @@ namespace util { // arithmetic operators region operator+ (vector<2,T>) const; + region operator- (vector<2,T>) const; // Logical comparison operators bool operator ==(const region& rhs) const;