Move implementation of iterator_buffer::flush() to core.h
This commit is contained in:
parent
76e97dc4df
commit
3867d83482
@ -8,6 +8,7 @@
|
|||||||
#ifndef FMT_CORE_H_
|
#ifndef FMT_CORE_H_
|
||||||
#define FMT_CORE_H_
|
#define FMT_CORE_H_
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstdio> // std::FILE
|
#include <cstdio> // std::FILE
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -770,7 +771,10 @@ class iterator_buffer : public Traits, public buffer<T> {
|
|||||||
void grow(size_t) final FMT_OVERRIDE {
|
void grow(size_t) final FMT_OVERRIDE {
|
||||||
if (this->size() == buffer_size) flush();
|
if (this->size() == buffer_size) flush();
|
||||||
}
|
}
|
||||||
void flush();
|
void flush() {
|
||||||
|
out_ = std::copy_n(data_, this->limit(this->size()), out_);
|
||||||
|
this->clear();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit iterator_buffer(OutputIt out, size_t n = buffer_size)
|
explicit iterator_buffer(OutputIt out, size_t n = buffer_size)
|
||||||
|
|||||||
@ -566,12 +566,6 @@ void buffer<T>::append(const U* begin, const U* end) {
|
|||||||
begin += count;
|
begin += count;
|
||||||
} while (begin != end);
|
} 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
|
} // namespace detail
|
||||||
|
|
||||||
// The number of characters to store in the basic_memory_buffer object itself
|
// The number of characters to store in the basic_memory_buffer object itself
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user