From b63c16c55f604cd8dc0bb4441d7c674f5bc34d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 1 Nov 2021 14:56:23 +0100 Subject: ksys/util: Fix C++17 compliance in FixedString Lambda expressions cannot appear in a template argument pre-C++20. --- src/KingSystem/Utils/FixedString.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/KingSystem/Utils/FixedString.h') 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 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 buf{}; auto ptr = buf.data() + buf.length(); if (N == 0) { -- cgit v1.2.3