Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#20 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Start with the boost::circular_buffer constructor, set_capacity(), push_back(), size(), capacity(), and full() entry points, and reproduce the reported sequence of 1,000 insertions after setting capacity to 100. Compare the observed size and full() result with the circular buffer's documented capacity semantics; done means determining whether this is a library defect or an incorrect expectation and documenting or testing the conclusion.

Written by the indexing model from the issue text.

Description

Hi,
I have created a boost::circular_buffer<my_class_type> 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

Dominant language
C++
Stars
65
Forks
64
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/circular_buffer

All issues in boostorg/circular_buffer

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.