From 697e76ba30923797e9a83861dbb989c979c7b412 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 12 May 2023 11:53:22 -0700 Subject: [PATCH] Don't call init_named_args unnecessarily --- include/fmt/core.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 9b7fac85..4d50d383 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1765,7 +1765,7 @@ class format_arg_store { private: static const size_t num_args = sizeof...(Args); - static const size_t num_named_args = detail::count_named_args(); + static constexpr size_t num_named_args = detail::count_named_args(); static const bool is_packed = num_args <= detail::max_packed_args; using value_type = conditional_t, @@ -1792,7 +1792,8 @@ class format_arg_store basic_format_args(*this), #endif data_{detail::make_arg(args)...} { - detail::init_named_args(data_.named_args(), 0, 0, args...); + if (num_named_args != 0) + detail::init_named_args(data_.named_args(), 0, 0, args...); } };