Go to the documentation of this file.
26 #ifndef STATICCIRCULARBUFFER_H
27 #define STATICCIRCULARBUFFER_H
40 template <
typename T,
typename Allocator = std::allocator<T>>
99 throw std::runtime_error(
"Buffer is empty");
131 throw std::runtime_error(
"Buffer is empty");
147 void advance(
typename VectorType::iterator& it,
size_t distance = 1)
149 for (
size_t i = 0; i < distance; ++i)
162 #endif // STATICCIRCULARBUFFER_H
void advance(typename VectorType::iterator &it, size_t distance=1)
VectorType::iterator begin_iterator_
T & push_back()
push_back Increases the buffer size (not capacity) by one, and returns a reference to the last item i...
StaticCircularBuffer(size_t max_size, const T &val, const Allocator &alloc=Allocator())
VectorType::iterator end_iterator_
void set_capacity(size_t max_size, const T &val)
set_capacity Allocates memory for max_size copies of val
std::vector< T, Allocator > VectorType
VectorType & getBuffer()
getBuffer Provides a reference to the internal data structure, use at your own risk.
void pop_front()
pop_front Reduces buffer size by one, advancing the begin iterator
void clear()
clear Change the size of the buffer to 0 (not capacity) Only modifies internal iterators
CircularBuffer implementation that does not perform allocations/deallocations outside of the construc...