region: add vector addition operator

This commit is contained in:
Danny Robson 2015-02-20 15:26:59 +11:00
parent 4057a131c8
commit ba878238af
2 changed files with 15 additions and 1 deletions

View File

@ -297,7 +297,17 @@ util::region<T>::expanded (T mag) const
return expanded (mag, mag);
}
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
template <typename T>
util::region<T>
util::region<T>::operator+ (vector<2,T> rhs) const
{
return { x + rhs.x, y + rhs.y, w, h };
}
///////////////////////////////////////////////////////////////////////////////
template <typename T>
bool
util::region<T>::operator== (const region& rhs) const

View File

@ -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<T>& rhs) const;
bool operator !=(const region<T>& rhs) const