diff --git a/region.cpp b/region.cpp index aa6d41e5..c076a273 100644 --- a/region.cpp +++ b/region.cpp @@ -335,8 +335,6 @@ util::operator<< (std::ostream &os, const util::region &rhs) { //----------------------------------------------------------------------------- namespace util { - template struct region; - template struct region; template struct region; template struct region; template struct region; diff --git a/region.hpp b/region.hpp index 9c6d1ec7..3af41a92 100644 --- a/region.hpp +++ b/region.hpp @@ -31,8 +31,8 @@ namespace util { */ template struct region { - typedef T position_type; - typedef T size_type; + using position_type = T; + using size_type = typename try_unsigned::type; static constexpr size_t dimension = 2u; static constexpr size_t elements = dimension * 2; diff --git a/test/region.cpp b/test/region.cpp index aefe5b30..7c86a490 100644 --- a/test/region.cpp +++ b/test/region.cpp @@ -21,13 +21,13 @@ main (int, char **) { CHECK_EQ (region::UNIT.area (), 1.0); CHECK_EQ (region< float>::UNIT.area (), 1.0f); - CHECK (region (0, 0, 2, 2).includes (point<2,int>(1, 1))); - CHECK (region (0, 0, 2, 2).includes (point<2,int>(0, 0))); - CHECK (region (0, 0, 2, 2).includes (point<2,int>(2, 2))); + CHECK (region (0, 0, 2, 2).includes (point<2,unsigned>(1, 1))); + CHECK (region (0, 0, 2, 2).includes (point<2,unsigned>(0, 0))); + CHECK (region (0, 0, 2, 2).includes (point<2,unsigned>(2, 2))); - CHECK ( region (0, 0, 2, 2).contains (point<2,int>(1, 1))); - CHECK (!region (0, 0, 2, 2).contains (point<2,int>(0, 0))); - CHECK (!region (0, 0, 2, 2).contains (point<2,int>(2, 2))); + CHECK ( region (0, 0, 2, 2).contains (point<2,unsigned>(1, 1))); + CHECK (!region (0, 0, 2, 2).contains (point<2,unsigned>(0, 0))); + CHECK (!region (0, 0, 2, 2).contains (point<2,unsigned>(2, 2))); //CHECK (region (0, 0, 10, 10).includes (point2d (0.4, 0.01))); //CHECK (region (0, 0, 10, 10).contains (point2d (0.4, 0.01)));