mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 19:48:39 +00:00
add clear for https://github.com/esphome/esphome/pull/14733
This commit is contained in:
@@ -356,6 +356,13 @@ template<typename T, size_t N> class StaticRingBuffer {
|
||||
index_type size() const { return this->count_; }
|
||||
bool empty() const { return this->count_ == 0; }
|
||||
|
||||
/// Clear all elements (reset to empty)
|
||||
void clear() {
|
||||
this->head_ = 0;
|
||||
this->tail_ = 0;
|
||||
this->count_ = 0;
|
||||
}
|
||||
|
||||
Iterator begin() { return Iterator(this, 0); }
|
||||
Iterator end() { return Iterator(this, this->count_); }
|
||||
ConstIterator begin() const { return ConstIterator(this, 0); }
|
||||
|
||||
Reference in New Issue
Block a user