From 5428c93b9a13808d107b80dfd00d77d34f968e63 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 9 Apr 2015 17:47:35 +1000 Subject: [PATCH] coord: pass client class to coord base allows common typesafe implementation of cast and redim --- colour.hpp | 4 ++-- coord/base.hpp | 7 ++++--- extent.hpp | 4 ++-- point.hpp | 4 ++-- vector.hpp | 5 +++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/colour.hpp b/colour.hpp index e2174b50..de23b08a 100644 --- a/colour.hpp +++ b/colour.hpp @@ -29,8 +29,8 @@ namespace util { /// An RGBA colour POD type. template - struct colour : public coord::base<4,T,coord::rgba> { - using coord::base<4,T,coord::rgba>::base; + struct colour : public coord::base<4,T,colour,coord::rgba> { + using coord::base<4,T,util::colour,coord::rgba>::base; static const colour WHITE; static const colour BLACK; diff --git a/coord/base.hpp b/coord/base.hpp index cbd09701..13bd1f93 100644 --- a/coord/base.hpp +++ b/coord/base.hpp @@ -27,7 +27,7 @@ namespace util { namespace coord { ///////////////////////////////////////////////////////////////////////// - template + template class KLASS, typename ...tags> struct base : public init { static_assert (S > 0, "coord dimensions must be strictly positive"); @@ -44,8 +44,8 @@ namespace util { namespace coord { explicit base (T v) { std::fill (std::begin (this->data), std::end (this->data), v); } - base (const base &rhs) = default; - base& operator= (const base &rhs) = default; + base (const base &rhs) = default; + base& operator= (const base &rhs) = default; // element accessors T& operator[] (size_t i) { return this->data[i]; } @@ -57,6 +57,7 @@ namespace util { namespace coord { T* begin (void) { return std::begin (this->data); } T* end (void) { return std::end (this->data); } + /////////////////////////////////////////////////////////////////////// // conversions template