Add interface to move the first/last elements pointers

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reviewing the circular_buffer array_one() and array_two() interfaces and the Asio async_read() and beast::buffers_cat() usage described in the issue. Define how advancing the pointer should interact with existing push_back behavior, then add coverage showing that externally written bytes can be committed and are reported as readable data.

Written by the indexing model from the issue text.

Description

I would like to use circular_buffer with Asio. And I'm not the only one -> https://stackoverflow.com/questions/19859833/read-data-into-a-circular-buffer

I could do something like

beast::buffers_cat(
asio::buffer(array_one().first, array_one().second),
asio::buffer(array_two().first, array_two().second)
)

to inform asio's async_read() of where it can write the received data to.
async_read would tell me how many bytes it has actually written into the circular_buffer.... and here I hit the wall. I need an API in circular_buffer where I can tell it "advance the pointer X elements because, even if push_back has not been called, the data is there".

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.