diff --git a/include/fmt/format.h b/include/fmt/format.h index e0dacc1f..753696c6 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3334,9 +3334,8 @@ inline typename buffer_context::iterator format_to( const Args&... args) { internal::check_format_string(format_str); using context = buffer_context; - format_arg_store as{args...}; return internal::vformat_to(buf, to_string_view(format_str), - basic_format_args(as)); + {make_format_args(args...)}); } template @@ -3351,7 +3350,7 @@ template ::value)> inline OutputIt vformat_to(OutputIt out, const S& format_str, format_args_t> args) { - typedef internal::output_range> range; + using range = internal::output_range>; return vformat_to>(range(out), to_string_view(format_str), args); } @@ -3374,10 +3373,9 @@ inline OutputIt format_to(OutputIt out, const S& format_str, internal::is_string::value, ""); internal::check_format_string(format_str); - typedef format_context_t> context; - format_arg_store as{args...}; + using context = format_context_t>; return vformat_to(out, to_string_view(format_str), - basic_format_args(as)); + {make_format_args(args...)}); } template struct format_to_n_result { @@ -3406,8 +3404,8 @@ template vformat_to_n( OutputIt out, std::size_t n, basic_string_view format_str, format_to_n_args args) { - typedef internal::truncating_iterator It; - auto it = vformat_to(It(out, n), format_str, args); + auto it = vformat_to(internal::truncating_iterator(out, n), + format_str, args); return {it.base(), it.count()}; } @@ -3425,10 +3423,9 @@ inline format_to_n_result format_to_n(OutputIt out, std::size_t n, const S& format_str, const Args&... args) { internal::check_format_string(format_str); - using Char = char_t; - format_arg_store, Args...> as(args...); + using context = format_to_n_context>; return vformat_to_n(out, n, to_string_view(format_str), - format_to_n_args(as)); + {make_format_args(args...)}); } template @@ -3550,19 +3547,19 @@ FMT_END_NAMESPACE std::string s = format(FMT_STRING("{:d}"), "foo"); \endrst */ -#define FMT_STRING(s) \ - [] { \ - struct str : fmt::compile_string { \ - typedef typename std::remove_cv::type>::type>::type char_type; \ - FMT_CONSTEXPR operator fmt::basic_string_view() const { \ - return {s, sizeof(s) / sizeof(char_type) - 1}; \ - } \ - } result; \ - /* Suppress Qt Creator warning about unused operator. */ \ - (void)static_cast>( \ - result); \ - return result; \ +#define FMT_STRING(s) \ + [] { \ + struct str : fmt::compile_string { \ + using char_type = typename std::remove_cv::type>::type>::type; \ + FMT_CONSTEXPR operator fmt::basic_string_view() const { \ + return {s, sizeof(s) / sizeof(char_type) - 1}; \ + } \ + } result; \ + /* Suppress Qt Creator warning about unused operator. */ \ + (void)static_cast>( \ + result); \ + return result; \ }() #if defined(FMT_STRING_ALIAS) && FMT_STRING_ALIAS