summaryrefslogtreecommitdiff
path: root/zen/ring_buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'zen/ring_buffer.h')
-rw-r--r--zen/ring_buffer.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/zen/ring_buffer.h b/zen/ring_buffer.h
index a8d629c6..240262fa 100644
--- a/zen/ring_buffer.h
+++ b/zen/ring_buffer.h
@@ -28,6 +28,8 @@ public:
}
RingBuffer& operator=(RingBuffer&& tmp) noexcept { swap(tmp); return *this; } //noexcept *required* to support move for reallocations in std::vector and std::swap!!!
+ ~RingBuffer() { clear(); }
+
using value_type = T;
using reference = T&;
using const_reference = const T&;
@@ -35,8 +37,6 @@ public:
size_t size() const { return size_; }
bool empty() const { return size_ == 0; }
- ~RingBuffer() { clear(); }
-
reference front() { checkInvariants(); assert(!empty()); return getBufPtr()[bufStart_]; }
const_reference front() const { checkInvariants(); assert(!empty()); return getBufPtr()[bufStart_]; }
@@ -184,7 +184,6 @@ public:
Iterator& operator++() { ++offset_; return *this; }
Iterator& operator+=(ptrdiff_t offset) { offset_ += offset; return *this; }
inline friend bool operator==(const Iterator& lhs, const Iterator& rhs) { assert(lhs.container_ == rhs.container_); return lhs.offset_ == rhs.offset_; }
- inline friend bool operator!=(const Iterator& lhs, const Iterator& rhs) { return !(lhs == rhs); }
inline friend ptrdiff_t operator-(const Iterator& lhs, const Iterator& rhs) { return lhs.offset_ - rhs.offset_; }
inline friend Iterator operator+(const Iterator& lhs, ptrdiff_t offset) { Iterator tmp(lhs); return tmp += offset; }
Value& operator* () const { return (*container_)[offset_]; }
bgstack15