From 3867d83482210ab5503920c643f02fad6260be27 Mon Sep 17 00:00:00 2001 From: Matthew Pohlmann Date: Thu, 13 Aug 2020 23:22:08 -0700 Subject: [PATCH] Move implementation of iterator_buffer::flush() to core.h --- include/fmt/core.h | 6 +++++- include/fmt/format.h | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 2b474e36..f1856ce6 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -8,6 +8,7 @@ #ifndef FMT_CORE_H_ #define FMT_CORE_H_ +#include #include // std::FILE #include #include @@ -770,7 +771,10 @@ class iterator_buffer : public Traits, public buffer { void grow(size_t) final FMT_OVERRIDE { if (this->size() == buffer_size) flush(); } - void flush(); + void flush() { + out_ = std::copy_n(data_, this->limit(this->size()), out_); + this->clear(); + } public: explicit iterator_buffer(OutputIt out, size_t n = buffer_size) diff --git a/include/fmt/format.h b/include/fmt/format.h index 7dbe90c2..65d19a36 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -566,12 +566,6 @@ void buffer::append(const U* begin, const U* end) { begin += count; } while (begin != end); } - -template -void iterator_buffer::flush() { - out_ = std::copy_n(data_, this->limit(this->size()), out_); - this->clear(); -} } // namespace detail // The number of characters to store in the basic_memory_buffer object itself