From 6056e07125a2c84f5fb1b65e14bf8d851a840071 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 30 Dec 2022 19:35:05 -0800 Subject: [PATCH] Simplify symbols --- include/fmt/core.h | 15 ++++++++------- include/fmt/format.h | 9 ++++----- src/format.cc | 3 +-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 4e295114..8ae3214a 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1850,10 +1850,6 @@ using buffer_context = basic_format_context, Char>; using format_context = buffer_context; -// Workaround an alias issue: https://stackoverflow.com/q/62767544/471164. -#define FMT_BUFFER_CONTEXT(Char) \ - basic_format_context, Char> - template using is_formattable = bool_constant< !std::is_base_of struct vformat_args { + using type = basic_format_args< + basic_format_context>, Char>>; +}; +template <> struct vformat_args { using type = format_args; }; + +// Use vformat_args and avoid type_identity to keep symbols short. template void vformat_to(buffer& buf, basic_string_view fmt, - basic_format_args args, - locale_ref loc = {}); + typename vformat_args::type args, locale_ref loc = {}); FMT_API void vprint_mojibake(std::FILE*, string_view, format_args); #ifndef _WIN32 diff --git a/include/fmt/format.h b/include/fmt/format.h index d34e23c4..8f05c7d9 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4142,8 +4142,7 @@ FMT_BEGIN_DETAIL_NAMESPACE template void vformat_to(buffer& buf, basic_string_view fmt, - basic_format_args args, - locale_ref loc) { + typename vformat_args::type args, locale_ref loc) { // workaround for msvc bug regarding name-lookup in module // link names into function scope using detail::arg_formatter; @@ -4223,9 +4222,9 @@ void vformat_to(buffer& buf, basic_string_view fmt, } #ifndef FMT_HEADER_ONLY -extern template FMT_API void vformat_to( - buffer&, string_view, basic_format_args, - locale_ref); +extern template FMT_API void vformat_to(buffer&, string_view, + typename vformat_args<>::type, + locale_ref); extern template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result; extern template FMT_API auto thousands_sep_impl(locale_ref) diff --git a/src/format.cc b/src/format.cc index 19dff444..391d3a24 100644 --- a/src/format.cc +++ b/src/format.cc @@ -29,8 +29,7 @@ template FMT_API auto decimal_point_impl(locale_ref) -> char; template FMT_API void buffer::append(const char*, const char*); template FMT_API void vformat_to(buffer&, string_view, - basic_format_args, - locale_ref); + typename vformat_args<>::type, locale_ref); // Explicit instantiations for wchar_t.