mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-09-02 18:57:56 +00:00
Change static const
to static constexpr
wherever possible
Since we require C++11, most of these consts can be constexpr. Two `static const ld` remain non-compile-time-evaluable because they depend on the runtime `log` function. One `static const cld` remains non-compile-time because `std::complex<T>` doesn't become constexpr until C++14.
This commit is contained in:
@@ -12,8 +12,8 @@ EX namespace euc {
|
||||
|
||||
#if HDR
|
||||
struct coord : array<int, 3> {
|
||||
coord() {}
|
||||
coord(int x, int y, int z) { self[0] = x; self[1] = y; self[2] = z; }
|
||||
explicit coord() = default;
|
||||
constexpr explicit coord(int x, int y, int z) : array{x,y,z} {}
|
||||
coord& operator += (coord b) { for(int i: {0,1,2}) self[i] += b[i]; return self; }
|
||||
coord& operator -= (coord b) { for(int i: {0,1,2}) self[i] -= b[i]; return self; }
|
||||
coord operator + (coord b) const { coord a = self; return a += b; }
|
||||
@@ -32,7 +32,7 @@ EX namespace euc {
|
||||
EX const coord eutester = coord(3,7,0);
|
||||
EX intmatrix euzeroall = make_array<coord>(euzero, euzero, euzero);
|
||||
|
||||
static const intmatrix main_axes = make_array<coord>(coord(1,0,0), coord(0,1,0), coord(0,0,1));
|
||||
static constexpr intmatrix main_axes = make_array<coord>(coord(1,0,0), coord(0,1,0), coord(0,0,1));
|
||||
|
||||
EX vector<coord> get_shifttable() {
|
||||
static const coord D0 = main_axes[0];
|
||||
|
Reference in New Issue
Block a user