mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-02 06:05:53 +00:00
circular_buffer: fix pop_front(), pop_back()
These methods should destroy the objects they are popping. We probably haven't seen any leaks since we usually move() the item before popping it.
This commit is contained in:
@@ -281,6 +281,7 @@ template <typename T, typename Alloc>
|
||||
inline
|
||||
void
|
||||
circular_buffer<T, Alloc>::pop_front() {
|
||||
_impl.destroy(&front());
|
||||
++_impl.begin;
|
||||
if (_impl.begin == _impl.storage + _impl.capacity) {
|
||||
_impl.begin = _impl.storage;
|
||||
@@ -292,6 +293,7 @@ template <typename T, typename Alloc>
|
||||
inline
|
||||
void
|
||||
circular_buffer<T, Alloc>::pop_back() {
|
||||
_impl.destroy(&back());
|
||||
if (_impl.end == _impl.begin) {
|
||||
_impl.end = _impl.storage + _impl.capacity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user