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:
Avi Kivity
2014-12-11 21:54:21 +02:00
parent 746dfae355
commit aaf9884064

View File

@@ -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;
}