From 7eda0af8fd072dcbc7e0d9362723b2841cf490d2 Mon Sep 17 00:00:00 2001 From: "M. Galib Uludag" Date: Mon, 27 Mar 2023 13:53:59 +0200 Subject: [PATCH] fixed fmt on msvc --- include/spdlog/common.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index ab356986..34dbd8f3 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -149,23 +149,29 @@ struct source_loc const char *funcname{nullptr}; }; -template +template struct format_string_wrapper { template - SPDLOG_CONSTEVAL format_string_wrapper(S fmt, details::source_location loc = details::source_location::current()) - : fmt_{fmt} + SPDLOG_CONSTEVAL format_string_wrapper(S fmtstr, details::source_location loc = details::source_location::current()) + : fmt_{fmtstr} , loc_{loc} {} - format_string_wrapper(fmt::basic_runtime fmtstr, details::source_location loc = details::source_location::current()) +#if !defined(SPDLOG_USE_STD_FORMAT) && FMT_VERSION >= 80000 + format_string_wrapper(fmt::basic_runtime fmtstr, details::source_location loc = details::source_location::current()) + : fmt_{fmtstr} + , loc_{loc} + {} +#endif + explicit format_string_wrapper(const Char* fmtstr, details::source_location loc = details::source_location::current()) : fmt_{fmtstr} , loc_{loc} {} - SPDLOG_CONSTEXPR T fmt() const + T fmt() { return fmt_; } - SPDLOG_CONSTEXPR source_loc loc() const + source_loc loc() { return source_loc{loc_.file_name(), loc_.line(), loc_.function_name()}; } @@ -218,9 +224,9 @@ using wmemory_buf_t = std::wstring; template # if __cpp_lib_format >= 202207L -using wformat_string_t = format_string_wrapper>; +using wformat_string_t = format_string_wrapper, wchar>; # else -using wformat_string_t = format_string_wrapper; +using wformat_string_t = format_string_wrapper; # endif # endif # define SPDLOG_BUF_TO_STRING(x) x @@ -249,7 +255,7 @@ using wstring_view_t = fmt::basic_string_view; using wmemory_buf_t = fmt::basic_memory_buffer; template -using wformat_string_t = fmt::wformat_string; +using wformat_string_t = format_string_wrapper, wchar>; # endif # define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x) #endif