diff --git a/include/spdlog/common.h b/include/spdlog/common.h index bf4e22e2..5393dfc9 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -129,6 +129,13 @@ namespace spdlog { class formatter; + +template +#if FMT_VERSION >= 90101 +using fmt_runtime_string = fmt::runtime_format_string; +#else +using fmt_runtime_string = fmt::basic_runtime; +#endif struct source_loc { @@ -156,7 +163,12 @@ struct format_string_wrapper , loc_{loc} {} #if !defined(SPDLOG_USE_STD_FORMAT) && FMT_VERSION >= 80000 - SPDLOG_CONSTEXPR format_string_wrapper(fmt::basic_runtime fmtstr, details::source_location loc = details::source_location::current()) + SPDLOG_CONSTEXPR format_string_wrapper(fmt_runtime_string fmtstr, details::source_location loc = details::source_location::current()) + : fmt_{fmtstr} + , loc_{loc} + {} +#elif !defined(SPDLOG_USE_STD_FORMAT) && FMT_VERSION < 80000 + SPDLOG_CONSTEXPR format_string_wrapper(const Char* fmtstr, details::source_location loc = details::source_location::current()) : fmt_{fmtstr} , loc_{loc} {} @@ -243,13 +255,6 @@ using format_string_t = format_string_wrapper, char> template using remove_cvref_t = typename std::remove_cv::type>::type; -template -#if FMT_VERSION >= 90101 -using fmt_runtime_string = fmt::runtime_format_string; -#else -using fmt_runtime_string = fmt::basic_runtime; -#endif - // clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the condition from basic_format_string here, // in addition, fmt::basic_runtime is only convertible to basic_format_string but not basic_string_view template