coord: make dimension constexpr

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

View File

@ -52,7 +52,7 @@ namespace util {
T data[S]; T data[S];
static const size_t dimension = S; static constexpr size_t dimension = S;
T& operator[] (size_t i) { return data[i]; } T& operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; } T operator[] (size_t i) const { return data[i]; }
@ -79,7 +79,7 @@ namespace util {
T x; T x;
}; };
static const size_t dimension = 1; static constexpr size_t dimension = 1;
T& operator[] (size_t i) { return data[i]; } T& operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; } T operator[] (size_t i) const { return data[i]; }
@ -113,7 +113,7 @@ namespace util {
}; };
}; };
static const size_t dimension = 2; static constexpr size_t dimension = 2;
T& operator[] (size_t i) { return data[i]; } T& operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; } T operator[] (size_t i) const { return data[i]; }
@ -137,7 +137,7 @@ namespace util {
}; };
}; };
static const size_t dimension = 3; static constexpr size_t dimension = 3;
coord () { ; } coord () { ; }
@ -184,7 +184,7 @@ namespace util {
}; };
}; };
static const size_t dimension = 4; static constexpr size_t dimension = 4;
coord () { ; } coord () { ; }