From b9ab5c8836bbffbe0a877f64d6faef8fbf4fd394 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 23 Apr 2021 10:42:57 -0700 Subject: [PATCH] Remove printf.h dependency on ostream.h --- include/fmt/printf.h | 10 +++++----- test/printf-test.cc | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/fmt/printf.h b/include/fmt/printf.h index fceb5e44..f061aac9 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -10,8 +10,9 @@ #include // std::max #include // std::numeric_limits +#include -#include "ostream.h" +#include "format.h" FMT_BEGIN_NAMESPACE namespace detail { @@ -194,7 +195,7 @@ FMT_DEPRECATED void printf(detail::buffer& buf, } using detail::vprintf; -// already exported through "ostream.h" above +// Exported from ostream.h. template class basic_printf_parse_context : public basic_format_parse_context { using basic_format_parse_context::basic_format_parse_context; @@ -290,8 +291,7 @@ template struct printf_formatter { } template - auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) { - detail::format_value(detail::get_container(ctx.out()), value); + auto format(const T&, FormatContext& ctx) -> decltype(ctx.out()) { return ctx.out(); } }; @@ -688,7 +688,7 @@ inline int vfprintf( basic_format_args>> args) { basic_memory_buffer buffer; vprintf(buffer, to_string_view(format), args); - detail::write_buffer(os, buffer); + os.write(buffer.data(), static_cast(buffer.size())); return static_cast(buffer.size()); } diff --git a/test/printf-test.cc b/test/printf-test.cc index 1c1173c4..ecad8835 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -12,6 +12,7 @@ #include #include "fmt/core.h" +#include "fmt/ostream.h" #include "gtest-extra.h" #include "util.h"