diff --git a/extent.cpp b/extent.cpp index d2061211..1d1214cb 100644 --- a/extent.cpp +++ b/extent.cpp @@ -29,6 +29,16 @@ template util::extent::extent (const T _width, const T _height): w (_width), h (_height) +{ + CHECK_GE (w, 0); + CHECK_GE (h, 0); +} + + +//----------------------------------------------------------------------------- +template +util::extent::extent (vector<2,T> _v): + extent (_v.x, _v.y) { ; } diff --git a/extent.hpp b/extent.hpp index 33aa7798..3dbbc4a2 100644 --- a/extent.hpp +++ b/extent.hpp @@ -24,6 +24,7 @@ #include + 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;