From 13d4f8469e885a0cbf83a647f91a60767d72e461 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 31 Aug 2025 10:02:36 -0700 Subject: [PATCH] Remove deprecated vformat_to --- include/fmt/format-inl.h | 4 ++-- include/fmt/format.h | 18 +----------------- include/fmt/xchar.h | 20 +++++++++++++++----- src/format.cc | 5 +---- 4 files changed, 19 insertions(+), 28 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 527a5bb1..6737e1d0 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -1463,8 +1463,8 @@ FMT_FUNC void vformat_to(buffer& buf, string_view fmt, format_args args, auto out = appender(buf); if (fmt.size() == 2 && equal2(fmt.data(), "{}")) return args.get(0).visit(default_arg_formatter{out}); - parse_format_string( - fmt, format_handler{parse_context(fmt), {out, args, loc}}); + parse_format_string(fmt, + format_handler<>{parse_context<>(fmt), {out, args, loc}}); } template struct span { diff --git a/include/fmt/format.h b/include/fmt/format.h index 54067946..b766c08b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3753,7 +3753,7 @@ template struct udl_arg { }; #endif // FMT_USE_NONTYPE_TEMPLATE_ARGS -template struct format_handler { +template struct format_handler { parse_context parse_ctx; buffered_context ctx; @@ -3819,22 +3819,6 @@ FMT_CONSTEXPR auto native_formatter::format( specs_.precision_ref, ctx); return write(ctx.out(), val, specs, ctx.locale()); } - -// DEPRECATED! -template struct vformat_args { - using type = basic_format_args>; -}; -template <> struct vformat_args { - using type = format_args; -}; - -template -void vformat_to(buffer& buf, basic_string_view fmt, - typename vformat_args::type args, locale_ref loc = {}) { - auto out = basic_appender(buf); - parse_format_string( - fmt, format_handler{parse_context(fmt), {out, args, loc}}); -} } // namespace detail FMT_BEGIN_EXPORT diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index df5dc926..51c5cfc1 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -55,6 +55,16 @@ inline auto write_loc(basic_appender out, loc_value value, #endif return false; } + +template +void vformat_to(buffer& buf, basic_string_view fmt, + basic_format_args> args, + locale_ref loc = {}) { + static_assert(!std::is_same::value, ""); + auto out = basic_appender(buf); + parse_format_string( + fmt, format_handler{parse_context(fmt), {out, args, loc}}); +} } // namespace detail FMT_BEGIN_EXPORT @@ -153,7 +163,7 @@ auto join(const Tuple& tuple, basic_string_view sep) template ::value)> auto vformat(basic_string_view fmt, - typename detail::vformat_args::type args) + basic_format_args> args) -> std::basic_string { auto buf = basic_memory_buffer(); detail::vformat_to(buf, fmt, args); @@ -186,7 +196,7 @@ auto format(const S& fmt, T&&... args) -> std::basic_string { template , FMT_ENABLE_IF(detail::is_exotic_char::value)> inline auto vformat(locale_ref loc, const S& fmt, - typename detail::vformat_args::type args) + basic_format_args> args) -> std::basic_string { auto buf = basic_memory_buffer(); detail::vformat_to(buf, detail::to_string_view(fmt), args, loc); @@ -207,7 +217,7 @@ template ::value&& detail::is_exotic_char::value)> auto vformat_to(OutputIt out, const S& fmt, - typename detail::vformat_args::type args) -> OutputIt { + basic_format_args> args) -> OutputIt { auto&& buf = detail::get_buffer(out); detail::vformat_to(buf, detail::to_string_view(fmt), args); return detail::get_iterator(buf, out); @@ -228,7 +238,7 @@ template ::value&& detail::is_exotic_char::value)> inline auto vformat_to(OutputIt out, locale_ref loc, const S& fmt, - typename detail::vformat_args::type args) + basic_format_args> args) -> OutputIt { auto&& buf = detail::get_buffer(out); vformat_to(buf, detail::to_string_view(fmt), args, loc); @@ -249,7 +259,7 @@ template ::value&& detail::is_exotic_char::value)> inline auto vformat_to_n(OutputIt out, size_t n, basic_string_view fmt, - typename detail::vformat_args::type args) + basic_format_args> args) -> format_to_n_result { using traits = detail::fixed_buffer_traits; auto buf = detail::iterator_buffer(out, n); diff --git a/src/format.cc b/src/format.cc index 50e267c5..05d0105b 100644 --- a/src/format.cc +++ b/src/format.cc @@ -30,16 +30,13 @@ template FMT_API auto decimal_point_impl(locale_ref) -> char; // DEPRECATED! template FMT_API void buffer::append(const char*, const char*); -// DEPRECATED! -template FMT_API void vformat_to(buffer&, string_view, - typename vformat_args<>::type, locale_ref); - // Explicit instantiations for wchar_t. template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result; template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; +// DEPRECATED! template FMT_API void buffer::append(const wchar_t*, const wchar_t*); } // namespace detail