summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-11-01 14:56:23 +0100
committerLéo Lam <leo@leolam.fr>2021-11-01 14:57:38 +0100
commitb63c16c55f604cd8dc0bb4441d7c674f5bc34d4b (patch)
tree2f50124bee19bad5933cb342e556438271cbc96b
parentd10dd65dcd371c87012b31700a871a8d6c5a9aa1 (diff)
ksys/util: Fix C++17 compliance in FixedString
Lambda expressions cannot appear in a template argument pre-C++20.
-rw-r--r--src/KingSystem/Utils/FixedString.h7
m---------toolchain/musl0
2 files changed, 4 insertions, 3 deletions
diff --git a/src/KingSystem/Utils/FixedString.h b/src/KingSystem/Utils/FixedString.h
index 039df272..1119ac0b 100644
--- a/src/KingSystem/Utils/FixedString.h
+++ b/src/KingSystem/Utils/FixedString.h
@@ -56,13 +56,14 @@ template <auto N, int base = 10>
constexpr auto Str() {
constexpr char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- FixedString<([]() constexpr noexcept {
+ constexpr auto len = [] {
unsigned int len = N > 0 ? 0 : 1;
for (auto n = N; n; len++, n /= base)
continue;
return len;
- }())>
- buf{};
+ }();
+
+ FixedString<len> buf{};
auto ptr = buf.data() + buf.length();
if (N == 0) {
diff --git a/toolchain/musl b/toolchain/musl
-Subproject 9a9252a54a67f54c066966f8f0599c450391bd4
+Subproject 25ed8669943bee65a650700d340e451eda2a26b