From 130b8fcdb9a14b0e032c40e498110eee63288892 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 11 May 2023 20:11:08 -0700 Subject: [PATCH] Reduce template instantiations --- include/fmt/core.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 926da552..75c07651 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1287,7 +1287,7 @@ template class value { : named_args{args, size} {} template FMT_CONSTEXPR FMT_INLINE value(T& val) { - using value_type = remove_cvref_t; + using value_type = remove_const_t; custom.value = const_cast(&val); // Get the formatter type through the context to allow different contexts // have different extension points, e.g. `formatter` for `format` and @@ -1549,9 +1549,9 @@ constexpr auto encode_types() -> unsigned long long { (encode_types() << packed_arg_bits); } -template -FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value { - auto&& arg = arg_mapper().map(FMT_FORWARD(val)); +template +FMT_CONSTEXPR FMT_INLINE auto make_arg(T& val) -> value { + auto&& arg = arg_mapper().map(val); using arg_type = remove_cvref_t; constexpr bool formattable_char = @@ -1578,14 +1578,10 @@ template FMT_CONSTEXPR auto make_arg(T& val) -> basic_format_arg { auto arg = basic_format_arg(); arg.type_ = mapped_type_constant::value; - arg.value_ = make_value(val); + arg.value_ = make_arg(val); return arg; } -template -FMT_CONSTEXPR FMT_INLINE auto make_arg(T& val) -> value { - return make_value(val); -} template FMT_CONSTEXPR inline auto make_arg(T& val) -> basic_format_arg { return make_arg(val);