Inline std::forward

This commit is contained in:
Victor Zverovich 2022-07-07 14:41:54 -07:00
parent d5e9166f54
commit cc1926942f

View File

@ -200,6 +200,9 @@
# endif # endif
#endif #endif
// An inline std::forward replacement.
#define FMT_FORWARD(T, value) static_cast<T&&>(value)
#ifdef _MSC_VER #ifdef _MSC_VER
# define FMT_UNCHECKED_ITERATOR(It) \ # define FMT_UNCHECKED_ITERATOR(It) \
using _Unchecked_type = It // Mark iterator as checked. using _Unchecked_type = It // Mark iterator as checked.
@ -1708,7 +1711,7 @@ constexpr auto encode_types() -> unsigned long long {
template <typename Context, typename T> template <typename Context, typename T>
FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value<Context> { FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value<Context> {
const auto& arg = arg_mapper<Context>().map(std::forward<T>(val)); const auto& arg = arg_mapper<Context>().map(FMT_FORWARD(T, val));
constexpr bool formattable_char = constexpr bool formattable_char =
!std::is_same<decltype(arg), const unformattable_char&>::value; !std::is_same<decltype(arg), const unformattable_char&>::value;
@ -1875,7 +1878,7 @@ class format_arg_store
data_{detail::make_arg< data_{detail::make_arg<
is_packed, Context, is_packed, Context,
detail::mapped_type_constant<remove_cvref_t<T>, Context>::value>( detail::mapped_type_constant<remove_cvref_t<T>, Context>::value>(
std::forward<T>(args))...} { FMT_FORWARD(T, args))...} {
detail::init_named_args(data_.named_args(), 0, 0, args...); detail::init_named_args(data_.named_args(), 0, 0, args...);
} }
}; };
@ -1891,7 +1894,7 @@ class format_arg_store
template <typename Context = format_context, typename... Args> template <typename Context = format_context, typename... Args>
constexpr auto make_format_args(Args&&... args) constexpr auto make_format_args(Args&&... args)
-> format_arg_store<Context, remove_cvref_t<Args>...> { -> format_arg_store<Context, remove_cvref_t<Args>...> {
return {std::forward<Args>(args)...}; return {FMT_FORWARD(Args, args)...};
} }
/** /**