Move implementation of iterator_buffer::flush() to core.h

This commit is contained in:
Matthew Pohlmann 2020-08-13 23:22:08 -07:00
parent 76e97dc4df
commit 3867d83482
2 changed files with 5 additions and 7 deletions

View File

@ -8,6 +8,7 @@
#ifndef FMT_CORE_H_
#define FMT_CORE_H_
#include <algorithm>
#include <cstdio> // std::FILE
#include <cstring>
#include <functional>
@ -770,7 +771,10 @@ class iterator_buffer : public Traits, public buffer<T> {
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)

View File

@ -566,12 +566,6 @@ void buffer<T>::append(const U* begin, const U* end) {
begin += count;
} while (begin != end);
}
template <typename OutputIt, typename T, typename Traits>
void iterator_buffer<OutputIt, T, Traits>::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