AK: Calculate CircularQueue::end() correctly

Previously end() was only correct when m_head == 0.
This commit is contained in:
Peter Elliott 2021-10-06 00:55:28 -06:00 committed by Andreas Kling
parent 3b7d8ed6a5
commit c515121844
Notes: sideshowbarker 2024-07-18 03:00:48 +09:00

View file

@ -93,7 +93,7 @@ public:
};
ConstIterator begin() const { return ConstIterator(*this, m_head); }
ConstIterator end() const { return ConstIterator(*this, size()); }
ConstIterator end() const { return ConstIterator(*this, (m_head + size()) % Capacity); }
size_t head_index() const { return m_head; }