diff --git a/doc/api.rst b/doc/api.rst index cc17effe..62fc10ea 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -113,8 +113,7 @@ binary footprint, for example (https://godbolt.org/z/oba4Mc): template void log(const char* file, int line, const S& format, Args&&... args) { - vlog(file, line, format, - fmt::make_args_checked(format, args...)); + vlog(file, line, format, fmt::make_format_args(args...)); } #define MY_LOG(format, ...) \ @@ -125,8 +124,6 @@ binary footprint, for example (https://godbolt.org/z/oba4Mc): Note that ``vlog`` is not parameterized on argument types which improves compile times and reduces binary code size compared to a fully parameterized version. -.. doxygenfunction:: fmt::make_args_checked(const S&, const remove_reference_t&...) - .. doxygenfunction:: fmt::make_format_args(const Args&...) .. doxygenclass:: fmt::format_arg_store diff --git a/include/fmt/color.h b/include/fmt/color.h index e46843c3..6d794c59 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -547,7 +547,7 @@ template (format_str, args...)); + fmt::make_format_args>>(args...)); } /** @@ -592,7 +592,7 @@ template > inline std::basic_string format(const text_style& ts, const S& format_str, const Args&... args) { return fmt::vformat(ts, to_string_view(format_str), - fmt::make_args_checked(format_str, args...)); + fmt::make_format_args>(args...)); } /** @@ -627,7 +627,7 @@ inline auto format_to(OutputIt out, const text_style& ts, const S& format_str, Args&&... args) -> typename std::enable_if::type { return vformat_to(out, ts, to_string_view(format_str), - fmt::make_args_checked(format_str, args...)); + fmt::make_format_args>>(args...)); } FMT_MODULE_EXPORT_END diff --git a/include/fmt/format.h b/include/fmt/format.h index afcba52e..99d1af6d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -834,8 +834,8 @@ class FMT_API format_error : public std::runtime_error { \endrst */ template > -FMT_INLINE auto make_args_checked(const S& fmt, - const remove_reference_t&... args) +FMT_DEPRECATED FMT_INLINE auto make_args_checked( + const S& fmt, const remove_reference_t&... args) -> format_arg_store, remove_reference_t...> { static_assert( detail::count<( @@ -2561,7 +2561,7 @@ template struct udl_formatter { template auto operator()(T&&... args) const -> std::basic_string { - return vformat(str, fmt::make_args_checked(str, args...)); + return vformat(str, fmt::make_format_args>(args...)); } }; diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 2bb79bbb..567303d3 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -136,7 +136,7 @@ template ::value, char_t>> void print(std::basic_ostream& os, const S& format_str, Args&&... args) { vprint(os, to_string_view(format_str), - fmt::make_args_checked(format_str, args...)); + fmt::make_format_args>(args...)); } FMT_END_NAMESPACE diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index 55825077..9b57815d 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -92,8 +92,8 @@ auto vformat(basic_string_view format_str, template , FMT_ENABLE_IF(!std::is_same::value)> auto format(const S& format_str, Args&&... args) -> std::basic_string { - const auto& vargs = fmt::make_args_checked(format_str, args...); - return vformat(to_string_view(format_str), vargs); + return vformat(to_string_view(format_str), + fmt::make_format_args>(args...)); } template , @@ -113,7 +113,7 @@ template std::basic_string { return detail::vformat(loc, to_string_view(format_str), - fmt::make_args_checked(format_str, args...)); + fmt::make_format_args>(args...)); } template , @@ -132,8 +132,8 @@ template ::value&& detail::is_exotic_char::value)> inline auto format_to(OutputIt out, const S& fmt, Args&&... args) -> OutputIt { - const auto& vargs = fmt::make_args_checked(fmt, args...); - return vformat_to(out, to_string_view(fmt), vargs); + return vformat_to(out, to_string_view(fmt), + fmt::make_format_args>(args...)); } template & buf, const S& format_str, Args&&... args) -> typename buffer_context::iterator { - const auto& vargs = fmt::make_args_checked(format_str, args...); - detail::vformat_to(buf, to_string_view(format_str), vargs, {}); + detail::vformat_to(buf, to_string_view(format_str), + fmt::make_format_args>(args...), {}); return detail::buffer_appender(buf); } @@ -167,8 +167,8 @@ template < inline auto format_to(OutputIt out, const Locale& loc, const S& format_str, Args&&... args) -> typename std::enable_if::type { - const auto& vargs = fmt::make_args_checked(format_str, args...); - return vformat_to(out, loc, to_string_view(format_str), vargs); + return vformat_to(out, loc, to_string_view(format_str), + fmt::make_format_args>(args...)); } template ::value)> inline auto format_to_n(OutputIt out, size_t n, const S& fmt, const Args&... args) -> format_to_n_result { - const auto& vargs = fmt::make_args_checked(fmt, args...); - return vformat_to_n(out, n, to_string_view(fmt), vargs); + return vformat_to_n(out, n, to_string_view(fmt), + fmt::make_format_args>(args...)); } template , FMT_ENABLE_IF(detail::is_exotic_char::value)> inline auto formatted_size(const S& fmt, Args&&... args) -> size_t { detail::counting_buffer buf; - const auto& vargs = fmt::make_args_checked(fmt, args...); - detail::vformat_to(buf, to_string_view(fmt), vargs); + detail::vformat_to(buf, to_string_view(fmt), + fmt::make_format_args>(args...)); return buf.count(); } diff --git a/test/module-test.cc b/test/module-test.cc index 7fbf763d..62e5fe8b 100644 --- a/test/module-test.cc +++ b/test/module-test.cc @@ -195,13 +195,6 @@ TEST(module_test, wformat_args) { EXPECT_TRUE(args.get(0)); } -TEST(module_test, checked_format_args) { - fmt::basic_format_args args = fmt::make_args_checked("{}", 42); - EXPECT_TRUE(args.get(0)); - fmt::basic_format_args wargs = fmt::make_args_checked(L"{}", 42); - EXPECT_TRUE(wargs.get(0)); -} - TEST(module_test, dynamic_format_args) { fmt::dynamic_format_arg_store dyn_store; dyn_store.push_back(fmt::arg("a42", 42));