Use forwarding references in UDL template

This commit is contained in:
Charles Milette 2019-07-27 17:55:21 -04:00 committed by Victor Zverovich
parent d0f2f3b816
commit ad71f5a706

View File

@ -3455,13 +3455,13 @@ namespace internal {
template <typename Char, Char... CHARS> class udl_formatter { template <typename Char, Char... CHARS> class udl_formatter {
public: public:
template <typename... Args> template <typename... Args>
std::basic_string<Char> operator()(const Args&... args) const { std::basic_string<Char> operator()(Args&&... args) const {
FMT_CONSTEXPR_DECL Char s[] = {CHARS..., '\0'}; FMT_CONSTEXPR_DECL Char s[] = {CHARS..., '\0'};
FMT_CONSTEXPR_DECL bool invalid_format = FMT_CONSTEXPR_DECL bool invalid_format =
do_check_format_string<Char, error_handler, Args...>( do_check_format_string<Char, error_handler, Args...>(
basic_string_view<Char>(s, sizeof...(CHARS))); basic_string_view<Char>(s, sizeof...(CHARS)));
(void)invalid_format; (void)invalid_format;
return format(s, args...); return format(s, std::forward<Args>(args)...);
} }
}; };
# else # else