fix(buffers): make_buffer returns mutable_buffer for by-value mutable…#315
Conversation
|
An automated preview of the documentation is available at https://315.capy.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-06-15 22:47:06 UTC |
|
GCOVR code coverage report https://315.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-06-15 23:00:45 UTC |
7082c0d to
8210d9f
Compare
… ranges The generic mutable overload took an lvalue reference `make_buffer(T&)`, so a `boost::span<char>` passed as a temporary could not bind to it and fell through to the const overload, returning a `const_buffer` (cppalliance#147). `std::span<char>` only escaped this via a dedicated by-value overload. Change the generic mutable overloads to a forwarding reference `make_buffer(T&&)` so by-value mutable contiguous ranges bind there and return `mutable_buffer`. Remove the now-redundant explicit C-array, std::array, std::vector, std::basic_string, and std::span overloads, which the concept-based generic overloads fully subsume; prune the includes they required. Behavior is preserved for all non-empty inputs; for empty array/ const-string/span the returned (size-0) buffer's data pointer is now normalized to nullptr, matching vector/string. Add a prvalue std::span regression test plus a boost::span test guarded by __has_include so Capy still builds and passes without Boost present.
8210d9f to
8338803
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #315 +/- ##
===========================================
- Coverage 98.09% 98.07% -0.03%
===========================================
Files 164 164
Lines 8873 8757 -116
===========================================
- Hits 8704 8588 -116
Misses 169 169
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
… ranges
The generic mutable overload took an lvalue reference
make_buffer(T&), so aboost::span<char>passed as a temporary could not bind to it and fell through to the const overload, returning aconst_buffer(#147).std::span<char>only escaped this via a dedicated by-value overload.Change the generic mutable overloads to a forwarding reference
make_buffer(T&&)so by-value mutable contiguous ranges bind there and returnmutable_buffer. Remove the now-redundant explicit C-array, std::array, std::vector, std::basic_string, and std::span overloads, which the concept-based generic overloads fully subsume; prune the includes they required.Behavior is preserved for all non-empty inputs; for empty array/ const-string/span the returned (size-0) buffer's data pointer is now normalized to nullptr, matching vector/string.
Add a prvalue std::span regression test plus a boost::span test guarded by __has_include so Capy still builds and passes without Boost present.
Closes #147