From 0b7c045a2fa28b6a2f6547bea975347e64e58f2d Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 8 Mar 2022 15:31:51 -0800 Subject: [PATCH] Simplify _cf --- include/fmt/compile.h | 10 ++++------ include/fmt/format.h | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 8ce043f6..b2bf1ba1 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -589,12 +589,10 @@ void print(const S& format_str, const Args&... args) { #if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS inline namespace literals { -template -constexpr detail::udl_compiled_string< - remove_cvref_t, - sizeof(Str.data) / sizeof(decltype(Str.data[0])), Str> -operator""_cf() { - return {}; +template constexpr auto operator""_cf() { + using char_t = remove_cvref_t; + return detail::udl_compiled_string(); } } // namespace literals #endif diff --git a/include/fmt/format.h b/include/fmt/format.h index ca9da512..7c469985 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -894,7 +894,6 @@ FMT_DEPRECATED FMT_INLINE auto make_args_checked( return {args...}; } -// compile-time support namespace detail_exported { #if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS template struct fixed_string { @@ -902,7 +901,7 @@ template struct fixed_string { detail::copy_str(static_cast(str), str + N, data); } - Char data[N]{}; + Char data[N] = {}; }; #endif @@ -3151,7 +3150,8 @@ void vformat_to( buffer_context context; format_handler(buffer_appender p_out, basic_string_view str, - basic_format_args> p_args, locale_ref p_loc) + basic_format_args> p_args, + locale_ref p_loc) : parse_context(str), context(p_out, p_args, p_loc) {} void on_text(const Char* begin, const Char* end) {