From 1e0c6cdc3ba05fe740860ded5e92ee33792c3f11 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 3 Sep 2024 20:44:37 -0700 Subject: [PATCH] Make symbol sizes shorter --- include/fmt/base.h | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index 4c00d729..6dd9dda0 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -2759,30 +2759,31 @@ template struct runtime_format_string { inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; } /// A compile-time format string. -template class basic_format_string { +template class fstring { private: basic_string_view str_; static constexpr int num_static_named_args = - detail::count_static_named_args(); + detail::count_static_named_args(); using checker = detail::format_string_checker< - Char, static_cast(sizeof...(Args)), num_static_named_args, - num_static_named_args != detail::count_named_args()>; + Char, static_cast(sizeof...(T)), num_static_named_args, + num_static_named_args != detail::count_named_args()>; - using arg_pack = detail::arg_pack; + using arg_pack = detail::arg_pack; public: - // Reports a compile-time error if S is not a valid format string for Args. + using t = fstring; + + // Reports a compile-time error if S is not a valid format string for T. template >::value)> - FMT_CONSTEVAL FMT_ALWAYS_INLINE basic_format_string(const S& s) : str_(s) { + FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const S& s) : str_(s) { using namespace detail; - static_assert( - count<(std::is_base_of>::value && - std::is_reference::value)...>() == 0, - "passing views as lvalues is disallowed"); + static_assert(count<(std::is_base_of>::value && + std::is_reference::value)...>() == 0, + "passing views as lvalues is disallowed"); if (FMT_USE_CONSTEVAL) parse_format_string(s, checker(s, arg_pack())); #ifdef FMT_ENFORCE_COMPILE_STRING static_assert( @@ -2793,20 +2794,22 @@ template class basic_format_string { template ::value&& std::is_same::value)> - FMT_ALWAYS_INLINE basic_format_string(const S& s) : str_(s) { + FMT_ALWAYS_INLINE fstring(const S& s) : str_(s) { FMT_CONSTEXPR auto fmt = basic_string_view(S()); FMT_CONSTEXPR int ignore = (parse_format_string(fmt, checker(fmt, arg_pack())), 0); detail::ignore_unused(ignore); } - basic_format_string(runtime_format_string fmt) : str_(fmt.str) {} + fstring(runtime_format_string fmt) : str_(fmt.str) {} FMT_ALWAYS_INLINE operator basic_string_view() const { return str_; } auto get() const -> basic_string_view { return str_; } }; -template -using format_string = basic_format_string...>; +template +using basic_format_string = typename fstring::t; + +template using format_string = typename fstring::t; template using is_formattable = bool_constant<