refactor!: make io_result an alias for std::tuple - #379
Conversation
A distinct result type cannot opt into the standard tuple utilities: std::apply is specified in terms of std::get, which cannot be overloaded for program-defined types, and tuple's operator= only accepts tuple-like types, so std::tie can never rebind from one. Define io_result as std::tuple<error_code, Ts...> instead, making tie, apply, tuple_cat, comparisons, and tuple assignment all work (closes cppalliance#266). tie in particular gives callers a rebinding style that avoids structured bindings entirely. Outcome detection for the io-aware when_all/when_any overloads is now structural, matching the channel-splitting rule the sender bridge already uses: any tuple whose first element is error_code participates, regardless of spelling. The type-level [[nodiscard]] migrates to await_resume on the library's awaitables; task<T> gains a nodiscard overload when T is an outcome, so discarding an awaited error still warns. Two construction idioms had to change. extract_results built its container with CTAD, which now collapses a single child through tuple's copy deduction guide; the element types are spelled out. And the {{}, n} success shorthand is ambiguous in libstdc++, where the leading {} also matches allocator_arg_t in the allocator-extended constructors; success results now spell std::error_code() explicitly.
|
An automated preview of the documentation is available at https://379.capy.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-08-17 18:57:53 UTC |
|
GCOVR code coverage report https://379.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-08-17 19:12:30 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #379 +/- ##
========================================
Coverage 98.09% 98.09%
========================================
Files 132 130 -2
Lines 6288 6291 +3
========================================
+ Hits 6168 6171 +3
Misses 120 120
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
A distinct result type cannot opt into the standard tuple utilities: std::apply is specified in terms of std::get, which cannot be overloaded for program-defined types, and tuple's operator= only accepts tuple-like types, so std::tie can never rebind from one. Define io_result as std::tuple<error_code, Ts...> instead, making tie, apply, tuple_cat, comparisons, and tuple assignment all work (closes #266). tie in particular gives callers a rebinding style that avoids structured bindings entirely.
Outcome detection for the io-aware when_all/when_any overloads is now structural, matching the channel-splitting rule the sender bridge already uses: any tuple whose first element is error_code participates, regardless of spelling.
The type-level [[nodiscard]] migrates to await_resume on the library's awaitables; task gains a nodiscard overload when T is an outcome, so discarding an awaited error still warns.
Two construction idioms had to change. extract_results built its container with CTAD, which now collapses a single child through tuple's copy deduction guide; the element types are spelled out. And the {{}, n} success shorthand is ambiguous in libstdc++, where the leading {} also matches allocator_arg_t in the allocator-extended constructors; success results now spell std::error_code() explicitly.
Resolves #266.