diff --git a/extent.cpp b/extent.cpp index e03d871b..cc996da4 100644 --- a/extent.cpp +++ b/extent.cpp @@ -27,13 +27,32 @@ using namespace util; +//----------------------------------------------------------------------------- template extent::extent (const T _width, const T _height): width (_width), height (_height) - { ; } +{ ; } +template +extent::extent (const extent &rhs): + width (rhs.width), + height (rhs.height) +{ ; } + + +template +extent& +extent::operator= (const extent &rhs) { + width = rhs.width; + height = rhs.height; + + return *this; +} + + +//----------------------------------------------------------------------------- template T extent::diameter (void) const { @@ -47,18 +66,21 @@ extent::area (void) const { return width * height; } +//----------------------------------------------------------------------------- template double extent::aspect (void) const { return static_cast (width) / height; } +//----------------------------------------------------------------------------- template bool extent::empty (void) const { return almost_equal (area(), 0); } +//----------------------------------------------------------------------------- template bool extent::operator ==(const extent& rhs) const { @@ -67,6 +89,7 @@ extent::operator ==(const extent& rhs) const { } +//----------------------------------------------------------------------------- template void extent::sanity (void) const @@ -86,6 +109,7 @@ namespace util { } +//----------------------------------------------------------------------------- namespace util { template struct extent; template struct extent; diff --git a/extent.hpp b/extent.hpp index d8996a10..b139a6bb 100644 --- a/extent.hpp +++ b/extent.hpp @@ -29,6 +29,8 @@ namespace util { T width, height; extent (const T _width, const T _height); + extent (const extent&); + extent& operator= (const extent&); T area (void) const; T diameter (void) const;