coord: add dimension constant

This commit is contained in:
Danny Robson 2015-01-12 15:59:55 +11:00
parent 143213db77
commit 04b22cb64d

View File

@ -49,6 +49,8 @@ namespace util {
T data[S];
static const size_t dimension = S;
T& operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; }
};
@ -71,6 +73,8 @@ namespace util {
T x;
};
static const size_t dimension = 1;
T& operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; }
};
@ -100,6 +104,8 @@ namespace util {
};
};
static const size_t dimension = 2;
T& operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; }
};
@ -122,6 +128,8 @@ namespace util {
};
};
static const size_t dimension = 3;
coord () { ; }
coord (T v)
@ -164,6 +172,8 @@ namespace util {
};
};
static const size_t dimension = 4;
coord () { ; }
coord (T v)