diff --git a/include/fmt/core.h b/include/fmt/core.h index 38abb71b..8848939f 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1698,7 +1698,7 @@ template class basic_format_context { public: using iterator = OutputIt; - using format_arg = basic_format_arg; // DEPRECATED! + using format_arg = basic_format_arg; using format_args = basic_format_args; using parse_context_type = basic_format_parse_context; template using formatter_type = formatter; diff --git a/include/fmt/printf.h b/include/fmt/printf.h index 2aef27a7..b43f7e36 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -18,9 +18,9 @@ FMT_BEGIN_EXPORT template struct printf_formatter { printf_formatter() = delete; }; -template class basic_printf_context { +template class basic_printf_context { private: - OutputIt out_; + detail::buffer_appender out_; basic_format_args args_; public: @@ -34,12 +34,12 @@ template class basic_printf_context { stored in the context object so make sure they have appropriate lifetimes. \endrst */ - basic_printf_context(OutputIt out, + basic_printf_context(detail::buffer_appender out, basic_format_args args) : out_(out), args_(args) {} - auto out() -> OutputIt { return out_; } - void advance_to(OutputIt it) { out_ = it; } + auto out() -> detail::buffer_appender { return out_; } + void advance_to(detail::buffer_appender) {} auto locale() -> detail::locale_ref { return {}; } @@ -226,7 +226,7 @@ template class printf_arg_formatter : public arg_formatter { private: using base = arg_formatter; - using context_type = basic_printf_context; + using context_type = basic_printf_context; context_type& context_; @@ -412,7 +412,7 @@ void vprintf(buffer& buf, basic_string_view format, basic_format_args args) { using iterator = buffer_appender; auto out = iterator(buf); - auto context = basic_printf_context(out, args); + auto context = basic_printf_context(out, args); auto parse_ctx = basic_format_parse_context(format); // Returns the argument with specified index or, if arg_index is -1, the next @@ -476,7 +476,7 @@ void vprintf(buffer& buf, basic_string_view format, auto nul = std::find(str, str_end, Char()); auto sv = basic_string_view( str, to_unsigned(nul != str_end ? nul - str : specs.precision)); - arg = make_arg>(sv); + arg = make_arg>(sv); } if (specs.alt && visit_format_arg(is_zero_int(), arg)) specs.alt = false; if (specs.fill[0] == '0') { @@ -538,8 +538,7 @@ void vprintf(buffer& buf, basic_string_view format, type = 'd'; break; case 'c': - visit_format_arg( - char_converter>(arg), arg); + visit_format_arg(char_converter>(arg), arg); break; } } @@ -557,12 +556,8 @@ void vprintf(buffer& buf, basic_string_view format, } FMT_END_DETAIL_NAMESPACE -template -using basic_printf_context_t = - basic_printf_context, Char>; - -using printf_context = basic_printf_context_t; -using wprintf_context = basic_printf_context_t; +using printf_context = basic_printf_context; +using wprintf_context = basic_printf_context; using printf_args = basic_format_args; using wprintf_args = basic_format_args; @@ -595,7 +590,7 @@ inline auto make_wprintf_args(const T&... args) template > inline auto vsprintf( const S& fmt, - basic_format_args>> args) + basic_format_args>> args) -> std::basic_string { auto buf = basic_memory_buffer(); detail::vprintf(buf, detail::to_string_view(fmt), args); @@ -614,15 +609,14 @@ inline auto vsprintf( template ::value, char_t>> inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string { - using context = basic_printf_context_t; return vsprintf(detail::to_string_view(fmt), - fmt::make_format_args(args...)); + fmt::make_format_args>(args...)); } template > inline auto vfprintf( std::FILE* f, const S& fmt, - basic_format_args>> args) + basic_format_args>> args) -> int { auto buf = basic_memory_buffer(); detail::vprintf(buf, detail::to_string_view(fmt), args); @@ -643,7 +637,7 @@ inline auto vfprintf( */ template > inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int { - using context = basic_printf_context_t; + using context = basic_printf_context; return vfprintf(f, detail::to_string_view(fmt), fmt::make_format_args(args...)); } @@ -651,7 +645,7 @@ inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int { template FMT_DEPRECATED inline auto vprintf( basic_string_view fmt, - basic_format_args>> args) + basic_format_args>> args) -> int { return vfprintf(stdout, fmt, args); }