Skip to content

Commit

Permalink
Remove printf.h dependency on ostream.h
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Apr 23, 2021
1 parent c47f211 commit b9ab5c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/fmt/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

#include <algorithm> // std::max
#include <limits> // std::numeric_limits
#include <ostream>

#include "ostream.h"
#include "format.h"

FMT_BEGIN_NAMESPACE
namespace detail {
Expand Down Expand Up @@ -194,7 +195,7 @@ FMT_DEPRECATED void printf(detail::buffer<Char>& buf,
}
using detail::vprintf;

// already exported through "ostream.h" above
// Exported from ostream.h.
template <typename Char>
class basic_printf_parse_context : public basic_format_parse_context<Char> {
using basic_format_parse_context<Char>::basic_format_parse_context;
Expand Down Expand Up @@ -290,8 +291,7 @@ template <typename T> struct printf_formatter {
}

template <typename FormatContext>
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();
}
};
Expand Down Expand Up @@ -688,7 +688,7 @@ inline int vfprintf(
basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args) {
basic_memory_buffer<Char> buffer;
vprintf(buffer, to_string_view(format), args);
detail::write_buffer(os, buffer);
os.write(buffer.data(), static_cast<std::streamsize>(buffer.size()));
return static_cast<int>(buffer.size());
}

Expand Down
1 change: 1 addition & 0 deletions test/printf-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <cstring>

#include "fmt/core.h"
#include "fmt/ostream.h"
#include "gtest-extra.h"
#include "util.h"

Expand Down

0 comments on commit b9ab5c8

Please sign in to comment.