From 599d6abd6cc74e80e8429fc309247be5f7edd5d7 Mon Sep 17 00:00:00 2001 From: Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> Date: Sun, 31 Mar 2024 23:47:28 -0500 Subject: [PATCH] Workaround bug for old msvc --- src/utils/microfmt.hpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/utils/microfmt.hpp b/src/utils/microfmt.hpp index ba47db7..0f750c3 100644 --- a/src/utils/microfmt.hpp +++ b/src/utils/microfmt.hpp @@ -302,20 +302,27 @@ namespace microfmt { } } - template #if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L + template std::string format(std::string_view fmt, Args&&... args) { - #else - std::string format(const std::string& fmt, Args&&... args) { - #endif return detail::format(fmt.begin(), fmt.end(), {detail::format_value(args)...}); } + inline std::string format(std::string_view fmt) { + return std::string(fmt); + } + #endif + template std::string format(const char* fmt, Args&&... args) { return detail::format(fmt, fmt + std::strlen(fmt), {detail::format_value(args)...}); } + // working around an old msvc bug https://godbolt.org/z/88T8hrzzq mre: https://godbolt.org/z/drd8echbP + inline std::string format(const char* fmt) { + return std::string(fmt); + } + template void print(const S& fmt, Args&&... args) { std::cout<