Skip to content

Add buffer_slice algorithm and Slice/MutableSlice concepts (#261)#280

Merged
mvandeberg merged 1 commit into
cppalliance:developfrom
mvandeberg:pr/261-buffer-slice
May 13, 2026
Merged

Add buffer_slice algorithm and Slice/MutableSlice concepts (#261)#280
mvandeberg merged 1 commit into
cppalliance:developfrom
mvandeberg:pr/261-buffer-slice

Conversation

@mvandeberg
Copy link
Copy Markdown
Contributor

Introduces a public free function buffer_slice(seq, offset, length) that returns an object of unspecified type satisfying the new Slice concept (data(), remove_prefix()). The implementation type detail::slice_impl<BS> tracks iteration state and exposes its current bytes through data(), which returns a buffer sequence view.

Replaces consuming_buffers, which conflated iteration state with the buffer-sequence role. The new design splits them: the slice is not itself a buffer sequence, eliminating the dual role and making the iteration-vs-slicing distinction explicit. The offset/length parameters generalize the abstraction beyond incremental consumption to arbitrary byte sub-ranges.

read(), write(), and write_now switched to the new algorithm.

Resolves #261

…ce#261)

Introduces a public free function `buffer_slice(seq, offset, length)`
that returns an object of unspecified type satisfying the new `Slice`
concept (`data()`, `remove_prefix()`). When `seq` models
`MutableBufferSequence`, the returned object additionally satisfies
`MutableSlice` — the slice-side analog of the
ConstBufferSequence / MutableBufferSequence refinement.

The implementation type `detail::slice_impl<BS>` tracks iteration
state and exposes its current bytes through `data()`, which returns
a buffer sequence view whose mutability follows from the input.

Replaces `consuming_buffers`, which conflated iteration state with
the buffer-sequence role. The new design splits them: the slice is
not itself a buffer sequence, eliminating the dual role and making
the iteration-vs-slicing distinction explicit. The offset/length
parameters generalize the abstraction beyond incremental consumption
to arbitrary byte sub-ranges.

`read()`, `write()`, and `write_now` switched to the new algorithm.
@cppalliance-bot
Copy link
Copy Markdown

An automated preview of the documentation is available at https://280.capy.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-05-13 16:07:03 UTC

@cppalliance-bot
Copy link
Copy Markdown

GCOVR code coverage report https://280.capy.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://280.capy.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://280.capy.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-05-13 16:20:31 UTC

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.44%. Comparing base (ac63112) to head (8c960a3).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #280      +/-   ##
===========================================
+ Coverage    92.37%   92.44%   +0.07%     
===========================================
  Files          168      170       +2     
  Lines         9414     9535     +121     
===========================================
+ Hits          8696     8815     +119     
- Misses         718      720       +2     
Flag Coverage Δ
linux 92.46% <ø> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/boost/capy/buffers/buffer_slice.hpp 100.00% <100.00%> (ø)
include/boost/capy/detail/slice_impl.hpp 100.00% <100.00%> (ø)
include/boost/capy/io/write_now.hpp 90.41% <ø> (ø)
include/boost/capy/read.hpp 100.00% <ø> (ø)
include/boost/capy/write.hpp 100.00% <ø> (ø)

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac63112...8c960a3. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mvandeberg mvandeberg merged commit 510a468 into cppalliance:develop May 13, 2026
39 checks passed
@mvandeberg mvandeberg deleted the pr/261-buffer-slice branch May 13, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buffer sequence slice manipulation

2 participants