Remove tag_invoke customization for buffer sequences (#262)#281
Conversation
|
An automated preview of the documentation is available at https://281.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-14 20:46:41 UTC |
|
GCOVR code coverage report https://281.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-05-14 20:57:31 UTC |
13e2899 to
d3955d3
Compare
Removes the tag_invoke machinery for buffer-sequence operations and the custom types whose only role was to participate in it. Buffer sequences are now plain ranges of `const_buffer` or `mutable_buffer` (or single buffer values). Removed: - `size_tag`, `slice_tag`, `slice_how` tag types and their `tag_invoke` friends on `mutable_buffer`, `const_buffer`, and `buffer_array`. - The generic `tag_invoke(size_tag, ConstBufferSequence)` overload. - `slice_of<>` and the slice CPOs (`keep_prefix`, `remove_prefix`, `keep_suffix`, `remove_suffix`, `prefix`, `suffix`, `sans_prefix`, `sans_suffix`) from `buffers/slice.hpp`. The file is deleted. - `const_buffer_pair` / `mutable_buffer_pair` aliases and the free `tag_invoke(slice_tag, ...)` on them. The aliases were just `std::array<X, 2>`; users now use `std::array` directly. Demoted: - `buffer_array<N, IsConst>` moves from `boost::capy::` to `boost::capy::detail::`. The class itself stays — it's the scatter/gather adapter used internally by `any_*` facilities, and is preserved modulo the namespace move and the removed tag_invoke friends. Convenience aliases `detail::const_buffer_array<N>` / `detail::mutable_buffer_array<N>` are preserved for brevity. Reimplemented: - `buffer_size` is now a plain free function template that iterates the range and sums sizes. No more CPO dispatch. Wrapped with a GCC-only `-Wmaybe-uninitialized` pragma (matching existing precedent in `write_now.hpp`) to suppress a GCC 13 false positive in iteration over `detail::buffer_array`'s union storage. `Slice` lifetime contract (refines cppalliance#261): - The `Slice` concept documents the lifetime contract explicitly: a Slice is associated, on construction, with an underlying buffer sequence. The slice — and any buffer sequence returned by its `data()` — is valid only while that underlying sequence remains valid. The buffer sequence returned by `data()` is independent of the slice object: subsequent operations on the slice (mutation, copy, move, destruction) do not invalidate an already-obtained view. - `buffer_slice` gains a deleted `BufferSequence const&&` overload to reject rvalue arguments at compile time. Passing a temporary buffer sequence would produce an immediately dangling slice; the deleted overload surfaces this as a compile error instead of runtime UB. Updated callers: - `any_*` facilities (`any_read_source`, `any_read_stream`, `any_write_stream`, `any_write_sink`) use `detail::buffer_array<N>`. - `circular_dynamic_buffer`'s `const_buffers_type` / `mutable_buffers_type` are `std::array<X, 2>` directly. - Test infrastructure (`bufgrind`, `test_buffers.hpp`) rewritten on top of `buffer_slice` / `Slice`. - Antora pages (`why-capy.adoc`, `9m.WhyNotCobalt.adoc`, `8c.buffer-composition.adoc`) updated to drop references to removed types; the buffer-composition example demonstrates `std::array<const_buffer, 2>` directly.
d3955d3 to
2edf7ac
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #281 +/- ##
===========================================
- Coverage 92.46% 91.99% -0.48%
===========================================
Files 170 164 -6
Lines 9535 8944 -591
===========================================
- Hits 8817 8228 -589
+ Misses 718 716 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 12 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Removes the tag_invoke machinery for buffer-sequence operations and the custom types whose only role was to participate in it. Buffer sequences are now plain ranges of
const_bufferormutable_buffer(or single buffer values).Removed:
size_tag,slice_tag,slice_howtag types and theirtag_invokefriends onmutable_buffer,const_buffer, andbuffer_array.tag_invoke(size_tag, ConstBufferSequence)overload.slice_of<>and the slice CPOs (keep_prefix,remove_prefix,keep_suffix,remove_suffix,prefix,suffix,sans_prefix,sans_suffix) frombuffers/slice.hpp. The file is deleted.const_buffer_pair/mutable_buffer_pairaliases and the freetag_invoke(slice_tag, ...)on them. The aliases were juststd::array<X, 2>; users now usestd::arraydirectly.Demoted:
buffer_array<N, IsConst>moves fromboost::capy::toboost::capy::detail::. The class itself stays — it's thescatter/gather adapter used internally by
any_*facilities, and is preserved modulo the namespace move and the removed tag_invoke friends. Convenience aliasesdetail::const_buffer_array<N>/detail::mutable_buffer_array<N>are preserved for brevity.Reimplemented:
buffer_sizeis now a plain free function template that iterates the range and sums sizes. No more CPO dispatch. Wrapped with a GCC-only-Wmaybe-uninitializedpragma (matching existing precedent inwrite_now.hpp) to suppress a GCC 13 false positive in iteration overdetail::buffer_array's union storage.Slicelifetime contract (refines #261):Sliceconcept documents the lifetime contract explicitly: a Slice is associated, on construction, with an underlying buffer sequence. The slice — and any buffer sequence returned by itsdata()— is valid only while that underlying sequence remains valid. The buffer sequence returned bydata()is independent of the slice object: subsequent operations on the slice (mutation, copy, move, destruction) do not invalidate an already-obtained view.buffer_slicegains a deletedBufferSequence const&&overload to reject rvalue arguments at compile time. Passing a temporary buffer sequence would produce an immediately dangling slice; the deleted overload surfaces this as a compile error instead of runtime UB.Updated callers:
any_*facilities (any_read_source,any_read_stream,any_write_stream,any_write_sink) usedetail::buffer_array<N>.circular_dynamic_buffer'sconst_buffers_type/mutable_buffers_typearestd::array<X, 2>directly.bufgrind,test_buffers.hpp) rewritten on top ofbuffer_slice/Slice.why-capy.adoc,9m.WhyNotCobalt.adoc,8c.buffer-composition.adoc) updated to drop references to removed types; the buffer-composition example demonstratesstd::array<const_buffer, 2>directly.Closes #262