General Utility Library for C++14
2.11
|
A ring buffer.
Classes | |
class | gul14::SlidingBuffer< ElementT, fixed_capacity, Container > |
A circular data buffer of (semi-)fixed capacity to which elements can be added at the front or at the back. More... | |
class | gul14::SlidingBufferExposed< ElementT, fixed_capacity, Container > |
A variant of SlidingBuffer that exposes the underlying container through its iterator interface. More... | |
Enumerations | |
enum class | gul14::ShrinkBehavior { keep_front_elements , keep_back_elements } |
Determine how a SlidingBuffer handles decreases of its size. More... | |
|
strong |
Determine how a SlidingBuffer handles decreases of its size.
When the buffer's capacity decreases below the actual size some elements have to be dropped. The user can choose between two strategies:
ShrinkBehavior::keep_front_elements
)ShrinkBehavior::keep_back_elements
)Usually the more recent data shall be preserved, while older data can be dropped.
The behavior is utilized by SlidingBuffer::resize(), SlidingBuffer::reserve(), SlidingBufferExposed::resize(), and SlidingBufferExposed::reserve().