diff options
| author | Markus Mittendrein <maxmitti@maxmitti.tk> | 2022-01-07 22:59:07 +0100 |
|---|---|---|
| committer | Markus Mittendrein <maxmitti@maxmitti.tk> | 2022-01-07 22:59:07 +0100 |
| commit | 93fb22c69728beba9b3d1eecd16fc7a32d1da8d4 (patch) | |
| tree | c25bf4d3a997c4065151aff51852f73b49bd836a | |
| parent | cb71e001e5088e9006c00634ce833f5659af855c (diff) | |
| download | cxxformat-93fb22c69728beba9b3d1eecd16fc7a32d1da8d4.tar.gz cxxformat-93fb22c69728beba9b3d1eecd16fc7a32d1da8d4.zip | |
Fix perfect forwarding
| -rw-r--r-- | include/cxxformat/core.hpp | 7 |
1 files changed, 4 insertions, 3 deletions
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>(args)...); } - auto&& arg = nth_argument<spec.argIndex>(std::forward<Args>(args)...); - using formatter = formatter_with_fallback<std::decay_t<decltype(arg)>>; + using Arg = nth_type<spec.argIndex, Args...>; + Arg&& arg = nth_argument<spec.argIndex>(std::forward<Args>(args)...); + using formatter = formatter_with_fallback<std::decay_t<Arg>>; []() consteval { // throws on error formatter::conversionSupported(spec); }(); - return formatter::format(out, arg, spec, minWidth, precision); + return formatter::format(out, std::forward<Arg>(arg), spec, minWidth, precision); }; (([&]{ |
