Simplify symbols

This commit is contained in:
Victor Zverovich 2022-12-30 19:35:05 -08:00
parent aa99b86409
commit 6056e07125
3 changed files with 13 additions and 14 deletions

View File

@ -1850,10 +1850,6 @@ using buffer_context =
basic_format_context<detail::buffer_appender<Char>, Char>;
using format_context = buffer_context<char>;
// Workaround an alias issue: https://stackoverflow.com/q/62767544/471164.
#define FMT_BUFFER_CONTEXT(Char) \
basic_format_context<detail::buffer_appender<Char>, Char>
template <typename T, typename Char = char>
using is_formattable = bool_constant<
!std::is_base_of<detail::unformattable,
@ -2757,11 +2753,16 @@ void check_format_string(S format_str) {
ignore_unused(error);
}
// Don't use type_identity for args to simplify symbols.
template <typename Char = char> struct vformat_args {
using type = basic_format_args<
basic_format_context<std::back_insert_iterator<buffer<Char>>, Char>>;
};
template <> struct vformat_args<char> { using type = format_args; };
// Use vformat_args and avoid type_identity to keep symbols short.
template <typename Char>
void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
basic_format_args<FMT_BUFFER_CONTEXT(Char)> args,
locale_ref loc = {});
typename vformat_args<Char>::type args, locale_ref loc = {});
FMT_API void vprint_mojibake(std::FILE*, string_view, format_args);
#ifndef _WIN32

View File

@ -4142,8 +4142,7 @@ FMT_BEGIN_DETAIL_NAMESPACE
template <typename Char>
void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
basic_format_args<FMT_BUFFER_CONTEXT(Char)> args,
locale_ref loc) {
typename vformat_args<Char>::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<Char>& buf, basic_string_view<Char> fmt,
}
#ifndef FMT_HEADER_ONLY
extern template FMT_API void vformat_to(
buffer<char>&, string_view, basic_format_args<FMT_BUFFER_CONTEXT(char)>,
locale_ref);
extern template FMT_API void vformat_to(buffer<char>&, string_view,
typename vformat_args<>::type,
locale_ref);
extern template FMT_API auto thousands_sep_impl<char>(locale_ref)
-> thousands_sep_result<char>;
extern template FMT_API auto thousands_sep_impl<wchar_t>(locale_ref)

View File

@ -29,8 +29,7 @@ template FMT_API auto decimal_point_impl(locale_ref) -> char;
template FMT_API void buffer<char>::append(const char*, const char*);
template FMT_API void vformat_to(buffer<char>&, string_view,
basic_format_args<FMT_BUFFER_CONTEXT(char)>,
locale_ref);
typename vformat_args<>::type, locale_ref);
// Explicit instantiations for wchar_t.