coord/base: c++14 style

This commit is contained in:
Danny Robson 2015-10-19 12:01:29 +11:00
parent b47cb6c560
commit f6933fb87d

View File

@ -25,7 +25,12 @@
namespace util { namespace coord {
/////////////////////////////////////////////////////////////////////////
template <size_t S, typename T, template <size_t, typename> class KLASS, typename ...tags>
template <
size_t S,
typename T,
template <size_t, typename> class KLASS,
typename ...tags
>
struct base : public init <S,T,tags...> {
static_assert (S > 0, "coord dimensions must be strictly positive");
@ -42,18 +47,18 @@ namespace util { namespace coord {
constexpr explicit base (T val)
{ for (size_t i = 0; i < S; ++i) this->data[i] = val; }
constexpr explicit base (const base<S,T,KLASS,tags...> &rhs) = default;
constexpr base (const base<S,T,KLASS,tags...> &rhs) = default;
base& operator= (const base<S,T,KLASS,tags...> &rhs) = default;
// element accessors
T& operator[] (size_t i) { return this->data[i]; }
T operator[] (size_t i) const { return this->data[i]; }
T& operator[] (size_t i) { return this->data[i]; }
constexpr const T& operator[] (size_t i) const { return this->data[i]; }
const T* begin (void) const { return std::begin (this->data); }
const T* end (void) const { return std::end (this->data); }
auto begin (void) const { return std::begin (this->data); }
auto end (void) const { return std::end (this->data); }
T* begin (void) { return std::begin (this->data); }
T* end (void) { return std::end (this->data); }
auto begin (void) { return std::begin (this->data); }
auto end (void) { return std::end (this->data); }
///////////////////////////////////////////////////////////////////////
// conversions