extent: add vector-only constructor

This commit is contained in:
Danny Robson 2015-02-20 21:53:51 +11:00
parent 84c957440b
commit 6c88184b6b
2 changed files with 12 additions and 0 deletions

View File

@ -29,6 +29,16 @@ template <typename T>
util::extent<T>::extent (const T _width, const T _height):
w (_width),
h (_height)
{
CHECK_GE (w, 0);
CHECK_GE (h, 0);
}
//-----------------------------------------------------------------------------
template <typename T>
util::extent<T>::extent (vector<2,T> _v):
extent (_v.x, _v.y)
{ ; }

View File

@ -24,6 +24,7 @@
#include <iostream>
namespace util {
/**
* A pure two-dimensional size, without positioning
@ -33,6 +34,7 @@ namespace util {
T w, h;
extent (const T _width, const T _height);
extent (vector<2,T>);
extent (const extent&);
extent& operator= (const extent&);
extent () = default;