From b8a6e8446a1a148e3975566286c50edf3c5aec3a Mon Sep 17 00:00:00 2001 From: Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> Date: Sun, 2 Jun 2024 12:47:53 -0500 Subject: [PATCH] Quick microfmt fix for an old msvc bug --- src/utils/microfmt.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/microfmt.hpp b/src/utils/microfmt.hpp index 1eadbe1..cc8d9b1 100644 --- a/src/utils/microfmt.hpp +++ b/src/utils/microfmt.hpp @@ -209,7 +209,7 @@ namespace microfmt { } }; for(; it != fmt_end; it++) { - if((*it == '{' || *it == '}') && peek(1) == *it) { // parse {{ and }}}} escapes + if((*it == '{' || *it == '}') && peek(1) == *it) { // parse {{ and }} escapes it++; } else if(*it == '{' && it + 1 != fmt_end) { auto saved_it = it; @@ -270,8 +270,9 @@ namespace microfmt { return detail::format(fmt.begin(), fmt.end(), {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(std::string_view fmt) { - return detail::format<0>(fmt.begin(), fmt.end(), {}); + return detail::format<1>(fmt.begin(), fmt.end(), {detail::format_value(1)}); } #endif @@ -280,7 +281,6 @@ namespace microfmt { 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 detail::format<1>(fmt, fmt + std::strlen(fmt), {detail::format_value(1)}); }