coord: add default copy and assign operators

This commit is contained in:
Danny Robson 2015-01-13 18:34:27 +11:00
parent ed62d9516e
commit 79cb10c7cb

View File

@ -47,6 +47,9 @@ namespace util {
coord (U ..._u): data{_u...}
{ ; }
coord (const coord<S,T> &rhs) = default;
coord& operator= (const coord<S,T> &rhs) = default;
T data[S];
static const size_t dimension = S;
@ -68,6 +71,9 @@ namespace util {
coord (U ..._u): data{_u...}
{ ; }
coord (const coord<1,T> &rhs) = default;
coord& operator= (const coord<1,T> &rhs) = default;
union {
T data[1];
T x;
@ -92,6 +98,9 @@ namespace util {
coord (U ..._u): data{_u...}
{ ; }
coord (const coord<2,T> &rhs) = default;
coord& operator= (const coord<2,T> &rhs) = default;
union {
T data[2];
struct {
@ -139,6 +148,9 @@ namespace util {
coord (U... u): data{u...}
{ ; }
coord (const coord<3,T> &rhs) = default;
coord& operator= (const coord<3,T> &rhs) = default;
T& operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; }
};
@ -183,6 +195,9 @@ namespace util {
coord (U... u): data{u...}
{ ; }
coord (const coord<4,T> &rhs) = default;
coord& operator= (const coord<4,T> &rhs) = default;
T& operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; }
};