From 1678ed6235d61470494198d56db3f1ebd98fcb6b Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Thu, 22 Apr 2021 20:43:01 +0300 Subject: [PATCH] simplify field::format() and spec_field::format(), fix typo --- include/fmt/compile.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 94a30b104c52..d231c83ea0b0 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -532,7 +532,7 @@ template struct code_unit { } }; -// This ensures that the argument type is convertile to `const T&`. +// This ensures that the argument type is convertible to `const T&`. template constexpr const T& get_arg_checked(const Args&... args) { const auto& arg = get(args...); @@ -552,8 +552,7 @@ template struct field { template constexpr OutputIt format(OutputIt out, const Args&... args) const { - const T& arg = get_arg_checked(args...); - return write(out, arg); + return write(out, get_arg_checked(args...)); } }; @@ -599,11 +598,10 @@ template struct spec_field { template constexpr OutputIt format(OutputIt out, const Args&... args) const { - const T& arg = get_arg_checked(args...); const auto& vargs = make_format_args>(args...); basic_format_context ctx(out, vargs); - return fmt.format(arg, ctx); + return fmt.format(get_arg_checked(args...), ctx); } };