Commit bad72844 authored by Václav Šmilauer's avatar Václav Šmilauer

Fix cicular_q::size()

parent 6f0cb636
......@@ -75,7 +75,14 @@ public:
// Return number of elements actually stored
size_t size() const
{
return (tail_ - head_) % max_items_;
if (tail_ > head_)
{
return (tail_ - head_) % max_items;
}
else
{
return max_items - (head_ - tail_ ) % max_items;
}
}
// Return const reference to item by index.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment