Add buffer_slice algorithm and Slice/MutableSlice concepts (#261)#280
Conversation
…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.
|
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 |
|
GCOVR code coverage report https://280.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-05-13 16:20:31 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Introduces a public free function
buffer_slice(seq, offset, length)that returns an object of unspecified type satisfying the newSliceconcept (data(),remove_prefix()). The implementation typedetail::slice_impl<BS>tracks iteration state and exposes its current bytes throughdata(), 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(), andwrite_nowswitched to the new algorithm.Resolves #261