36 virtual void erase(
const std::size_t num)
override;
37 virtual void eraseChunk(
const std::size_t chunk_size)
override;
41 beginChunk(
const std::size_t chunk_size)
const override;
46 virtual std::size_t
newEnd(
const std::size_t new_end)
override;
63 mooseAssert(num <= this->size(),
"Cannot erase past the last entry");
65 this->_end_pos -= num;
68 if (this->_begin_pos == this->_end_pos)
76 if (chunk_size > this->size())
77 this->erase(this->size());
79 this->erase(chunk_size);
86 if (chunk_size > this->size())
89 return this->end() - chunk_size;
96 if (chunk_size > this->size())
99 return this->end() - chunk_size;
102 template <
typename T>
109 template <
typename T>
116 template <
typename T>
120 if (new_end > this->_data.size())
122 auto new_size = new_end - this->_begin_pos;
124 this->_data.resize(
std::max(new_size * 2, this->_data.size() * 2));
std::vector< T >::const_iterator const_iterator
LIFOBuffer()
Create an empty LIFO buffer.
std::vector< T >::iterator iterator
auto max(const L &left, const R &right)
std::size_t capacity() const
Get the capacity.
virtual void eraseChunk(const std::size_t chunk_size) override
virtual void erase(const std::size_t num) override
Remove the first num elements.
An optimized LIFO (Last In First Out) buffer.
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 ...
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...