diff --git a/format.h b/format.h index bae04444..3a82f827 100644 --- a/format.h +++ b/format.h @@ -2601,12 +2601,18 @@ inline void format_decimal(char *&buffer, T value) { namespace fmt { namespace internal { -inline void set_types(Arg *) {} +inline void do_set_types(Arg *) {} template -inline void set_types(Arg *args, const T &arg, const Args & ... tail) { +inline void do_set_types(Arg *args, const T &arg, const Args & ... tail) { args->type = static_cast(MakeValue::type(arg)); - set_types(args + 1, tail...); + do_set_types(args + 1, tail...); +} + +template +inline void set_types(Arg *array, const Args & ... args) { + do_set_types(array, args...); + array[sizeof...(Args)].type = Arg::NONE; } // Computes the argument array size by adding 1 to N, which is the number of @@ -2628,10 +2634,8 @@ struct ArgArraySize { Arg array[fmt::internal::ArgArraySize::VALUE] = { \ fmt::internal::MakeValue(args)... \ }; \ - if (sizeof...(Args) > fmt::ArgList::MAX_PACKED_ARGS) { \ + if (sizeof...(Args) > fmt::ArgList::MAX_PACKED_ARGS) \ set_types(array, args...); \ - array[sizeof...(Args)].type = Arg::NONE; \ - } \ call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), \ fmt::ArgList(fmt::internal::make_type(args...), array)); \ }