1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-05 11:57:58 +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:
Arthur O'Dwyer
2023-08-23 09:44:37 -08:00
parent b70b339f52
commit 62629f3e70
48 changed files with 453 additions and 458 deletions

View File

@@ -907,13 +907,8 @@ EX namespace nilv {
#if HDR
struct mvec : array<int, 3> {
/** these are in nmHeis */
mvec() { }
mvec(int x, int y, int z) {
auto& a = *this;
a[0] = x; a[1] = y; a[2] = z;
}
explicit mvec() = default;
constexpr explicit mvec(int x, int y, int z) : array{x, y, z} {}
mvec inverse() {
auto& a = *this;
return mvec(-a[0], -a[1], -a[2]+a[1] * a[0]);
@@ -925,7 +920,7 @@ EX namespace nilv {
};
#endif
static const mvec mvec_zero = mvec(0, 0, 0);
static constexpr mvec mvec_zero = mvec(0, 0, 0);
EX ld nilwidth = 1;