From fe6eb792d5647cd1e2e95a6e2f9c1ab8fd203358 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 29 May 2022 19:00:22 -0700 Subject: [PATCH] Cleanup check_format_string --- doc/api.rst | 2 -- include/fmt/core.h | 23 ++++++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/doc/api.rst b/doc/api.rst index 02d10be8..acc7fa4c 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -322,8 +322,6 @@ Utilities .. doxygenfunction:: fmt::to_string(const T &value) -> std::string -.. doxygenfunction:: fmt::to_string_view(const Char *s) -> basic_string_view - .. doxygenfunction:: fmt::join(Range &&range, string_view sep) -> join_view, detail::sentinel_t> .. doxygenfunction:: fmt::join(It begin, Sentinel end, string_view sep) -> join_view diff --git a/include/fmt/core.h b/include/fmt/core.h index 4b5cace2..906e322f 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -546,18 +546,6 @@ template struct char_t_impl::value>> { using type = typename result::value_type; }; -// Reports a compile-time error if S is not a valid format string. -template ::value)> -FMT_INLINE void check_format_string(const S&) { -#ifdef FMT_ENFORCE_COMPILE_STRING - static_assert(is_compile_string::value, - "FMT_ENFORCE_COMPILE_STRING requires all format strings to use " - "FMT_STRING."); -#endif -} -template ::value)> -void check_format_string(S); - FMT_NORETURN FMT_API void throw_format_error(const char* message); struct error_handler { @@ -2921,8 +2909,17 @@ class format_string_checker { } }; +// Reports a compile-time error if S is not a valid format string. +template ::value)> +FMT_INLINE void check_format_string(const S&) { +#ifdef FMT_ENFORCE_COMPILE_STRING + static_assert(is_compile_string::value, + "FMT_ENFORCE_COMPILE_STRING requires all format strings to use " + "FMT_STRING."); +#endif +} template ::value), int>> + FMT_ENABLE_IF(is_compile_string::value)> void check_format_string(S format_str) { FMT_CONSTEXPR auto s = to_string_view(format_str); using checker = format_string_checker