Moving append to basic_memory_buffer.

This commit is contained in:
Barry Revzin 2020-08-07 12:04:41 -05:00
parent b8dc604b96
commit 6d54740295
2 changed files with 7 additions and 7 deletions

View File

@ -728,7 +728,6 @@ template <typename T> class buffer {
/** Appends data to the end of the buffer. */
template <typename U> void append(const U* begin, const U* end);
template <typename ContiguousRange> void append(const ContiguousRange&);
template <typename I> T& operator[](I index) { return ptr_[index]; }
template <typename I> const T& operator[](I index) const {

View File

@ -566,12 +566,6 @@ void buffer<T>::append(const U* begin, const U* end) {
} while (begin != end);
}
template <typename T>
template <typename ContiguousRange>
void buffer<T>::append(const ContiguousRange& range) {
append(range.data(), range.data() + range.size());
}
template <typename OutputIt, typename T, typename Traits>
void iterator_buffer<OutputIt, T, Traits>::flush() {
out_ = std::copy_n(data_, this->limit(this->size()), out_);
@ -691,6 +685,13 @@ class basic_memory_buffer : public detail::buffer<T> {
/** Increases the buffer capacity to *new_capacity*. */
void reserve(size_t new_capacity) { this->try_reserve(new_capacity); }
// Directly append data into the buffer
using detail::buffer<T>::append;
template <typename ContiguousRange>
void append(const ContiguousRange& range) {
append(range.data(), range.data() + range.size());
}
};
template <typename T, size_t SIZE, typename Allocator>