diff --git a/include/fmt/color.h b/include/fmt/color.h index b65f892a..83ff914d 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -496,7 +496,7 @@ void vformat_to(basic_memory_buffer& buf, const text_style& ts, template > void vprint(std::FILE* f, const text_style& ts, const S& format, - basic_format_args> args) { + basic_format_args>> args) { basic_memory_buffer buf; detail::vformat_to(buf, ts, to_string_view(format), args); buf.push_back(Char(0)); @@ -514,10 +514,8 @@ template ::value)> void print(std::FILE* f, const text_style& ts, const S& format_str, const Args&... args) { - detail::check_format_string(format_str); - using context = buffer_context>; - format_arg_store as{args...}; - vprint(f, ts, format_str, basic_format_args(as)); + vprint(f, ts, format_str, + detail::make_args_checked(format_str, args...)); } /** diff --git a/include/fmt/format.h b/include/fmt/format.h index 367f26d2..c8d9bf1b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3503,10 +3503,8 @@ template ::value, char_t>> inline typename buffer_context::iterator format_to( basic_memory_buffer& buf, const S& format_str, Args&&... args) { - detail::check_format_string(format_str); - using context = buffer_context; - return detail::vformat_to(buf, to_string_view(format_str), - make_format_args(args...)); + const auto& vargs = detail::make_args_checked(format_str, args...); + return detail::vformat_to(buf, to_string_view(format_str), vargs); } template @@ -3604,8 +3602,7 @@ template class udl_formatter { template std::basic_string operator()(Args&&... args) const { static FMT_CONSTEXPR_DECL Char s[] = {CHARS..., '\0'}; - check_format_string...>(FMT_STRING(s)); - return format(s, std::forward(args)...); + return format(FMT_STRING(s), std::forward(args)...); } }; # else diff --git a/include/fmt/locale.h b/include/fmt/locale.h index 8f1c7280..3b3e04b7 100644 --- a/include/fmt/locale.h +++ b/include/fmt/locale.h @@ -55,10 +55,13 @@ template ::value, char_t>> inline OutputIt vformat_to( OutputIt out, const std::locale& loc, const S& format_str, - format_args_t, Char> args) { - using af = detail::arg_formatter; - return vformat_to(out, to_string_view(format_str), args, - detail::locale_ref(loc)); + basic_format_args>> args) { + decltype(detail::get_buffer(out)) buf(detail::get_buffer_init(out)); + using af = + detail::arg_formatter::iterator, Char>; + vformat_to(detail::buffer_appender(buf), to_string_view(format_str), + args, detail::locale_ref(loc)); + return detail::get_iterator(buf); } template ::value)> inline OutputIt format_to(OutputIt out, const std::locale& loc, const S& format_str, Args&&... args) { - detail::check_format_string(format_str); - using context = format_context_t>; - format_arg_store as{args...}; - return vformat_to(out, loc, to_string_view(format_str), - basic_format_args(as)); + const auto& vargs = detail::make_args_checked(format_str, args...); + return vformat_to(out, loc, to_string_view(format_str), vargs); } FMT_END_NAMESPACE