boostorg / boostorg/circular_buffer

full() returns false even if the circular buffer is full

Open
#20 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
65
Forks
64
PR merge metrics
No merged PRs in 30d

Description

Hi,
I have created a boost::circular_buffer using the default ctor.
Then I call set_capacity(100) and then I push_back() a thousand elements: the size() of the circular buffer is reported as 99 and thus the function full() always return false.

I think this is very misleading: my belief is that instead of having:

bool full() const BOOST_NOEXCEPT { return capacity() == size(); }

we should have:

bool full() const BOOST_NOEXCEPT { return capacity()-1 == size(); }

What am I missing?

Thanks,
Francesco

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.