mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 02:21:34 +08:00
Fix cicular_q::size()
This commit is contained in:
parent
6f0cb6365e
commit
bad7284465
@ -75,7 +75,14 @@ public:
|
|||||||
// Return number of elements actually stored
|
// Return number of elements actually stored
|
||||||
size_t size() const
|
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.
|
// Return const reference to item by index.
|
||||||
|
Loading…
Reference in New Issue
Block a user