From bda4a77c8694eeb0d20ec8ae33f63b08a84e9f2d Mon Sep 17 00:00:00 2001 From: janis Date: Wed, 13 Jul 2022 01:39:48 +0100 Subject: [PATCH] if consteval fix for util::format --- include/format.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/format.hpp b/include/format.hpp index d8c74cf..2780cb4 100644 --- a/include/format.hpp +++ b/include/format.hpp @@ -10,7 +10,15 @@ namespace util { template inline constexpr auto format(std::string_view fmt, Ts&&... args) -> std::string { -return std::vformat(fmt, std::make_format_args(std::forward(args)...)); +#if defined(__cpp_if_consteval) && defined(doesnt_work_yet_in_clang_14) + if + consteval { return std::format(fmt, args...); } + else { + return std::vformat(fmt, std::make_format_args(std::forward(args)...)); + } +#else + return std::vformat(fmt, std::make_format_args(std::forward(args)...)); +#endif } template