43 virtual void erase(
const std::size_t num)
override;
44 virtual void eraseChunk(
const std::size_t chunk_size)
override;
48 beginChunk(
const std::size_t chunk_size)
const override;
53 virtual std::size_t
newEnd(
const std::size_t new_end)
override;
70 mooseAssert(num <= this->size(),
"Cannot erase past the last entry");
72 this->_begin_pos += num;
75 if (this->_begin_pos == this->_end_pos)
83 if (chunk_size > this->size())
84 this->erase(this->size());
86 this->erase(chunk_size);
100 return this->begin();
103 template <
typename T>
107 if (chunk_size > this->size())
110 return this->begin() + chunk_size;
113 template <
typename T>
117 if (chunk_size > this->size())
120 return this->begin() + chunk_size;
123 template <
typename T>
127 auto actual_new_end = new_end;
129 if (new_end > this->_data.size())
131 const auto new_size = new_end - this->_begin_pos;
134 if (this->_begin_pos == 0)
135 this->_data.resize(2 * new_size);
139 auto to_it = this->_data.begin();
140 for (
auto from_it = this->begin(); from_it < this->end(); ++from_it)
141 *to_it++ = std::move(*from_it);
143 this->_begin_pos = 0;
144 actual_new_end = new_size;
147 if (actual_new_end > this->_data.size())
148 this->_data.resize(2 * new_size);
152 return actual_new_end;
std::vector< T >::const_iterator const_iterator
virtual void eraseChunk(const std::size_t chunk_size) override
std::vector< T >::iterator iterator
std::size_t capacity() const
Get the capacity.
An optimized circular buffer.
virtual void erase(const std::size_t num) override
Remove the first num elements.
virtual std::size_t newEnd(const std::size_t new_end) override
Find out where the new end will be.
virtual Buffer< T >::iterator endChunk(const std::size_t chunk_size) override
Iterator for the last entry of a chunk size in the buffer If chunk_size is greater than the size of t...
virtual Buffer< T >::iterator beginChunk(const std::size_t chunk_size) override
Iterator for the first entry with a given chunk size in the buffer If chunk_size is greater than the ...