From c36dd825baf9300b5472d7e090a5ccba83a0fa1b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 12 May 2023 06:44:47 -0700 Subject: [PATCH] Remove unnecessary forwarding --- include/fmt/core.h | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 75c07651..9b7fac85 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -162,9 +162,6 @@ # endif #endif -// An inline std::forward replacement. -#define FMT_FORWARD(...) static_cast(__VA_ARGS__) - #ifdef _MSC_VER # define FMT_UNCHECKED_ITERATOR(It) \ using _Unchecked_type = It // Mark iterator as checked. @@ -1444,30 +1441,28 @@ template struct arg_mapper { return map(format_as(val)); } - template > - struct formattable - : bool_constant() || - (has_formatter::value && - !std::is_const>::value)> {}; + template > + struct formattable : bool_constant() || + (has_formatter::value && + !std::is_const::value)> {}; template ::value)> - FMT_CONSTEXPR FMT_INLINE auto do_map(T&& val) -> T& { + FMT_CONSTEXPR FMT_INLINE auto do_map(T& val) -> T& { return val; } template ::value)> - FMT_CONSTEXPR FMT_INLINE auto do_map(T&&) -> unformattable { + FMT_CONSTEXPR FMT_INLINE auto do_map(T&) -> unformattable { return {}; } - template , + template , FMT_ENABLE_IF((std::is_class::value || std::is_enum::value || std::is_union::value) && !is_string::value && !is_char::value && !is_named_arg::value && !std::is_arithmetic>::value)> - FMT_CONSTEXPR FMT_INLINE auto map(T&& val) - -> decltype(this->do_map(std::forward(val))) { - return do_map(std::forward(val)); + FMT_CONSTEXPR FMT_INLINE auto map(T& val) -> decltype(this->do_map(val)) { + return do_map(val); } template ::value)> @@ -1752,7 +1747,7 @@ using format_context = buffer_context; template using is_formattable = bool_constant>() - .map(std::declval()))>::value>; + .map(std::declval()))>::value>; /** \rst