From 93fb22c69728beba9b3d1eecd16fc7a32d1da8d4 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Fri, 7 Jan 2022 22:59:07 +0100 Subject: Fix perfect forwarding --- include/cxxformat/core.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/cxxformat/core.hpp b/include/cxxformat/core.hpp index 993060d..048b3c9 100644 --- a/include/cxxformat/core.hpp +++ b/include/cxxformat/core.hpp @@ -466,15 +466,16 @@ namespace format { precision = nth_argument<*spec.precision>(std::forward(args)...); } - auto&& arg = nth_argument(std::forward(args)...); - using formatter = formatter_with_fallback>; + using Arg = nth_type; + Arg&& arg = nth_argument(std::forward(args)...); + using formatter = formatter_with_fallback>; []() consteval { // throws on error formatter::conversionSupported(spec); }(); - return formatter::format(out, arg, spec, minWidth, precision); + return formatter::format(out, std::forward(arg), spec, minWidth, precision); }; (([&]{ -- cgit v1.2.3-54-g00ecf