Skip to content

Replace void filtering with monostate in when_all#227

Merged
mvandeberg merged 1 commit intocppalliance:developfrom
mvandeberg:pr/204-when-all-void
Mar 11, 2026
Merged

Replace void filtering with monostate in when_all#227
mvandeberg merged 1 commit intocppalliance:developfrom
mvandeberg:pr/204-when-all-void

Conversation

@mvandeberg
Copy link
Contributor

@mvandeberg mvandeberg commented Mar 11, 2026

Closes #204

Summary by CodeRabbit

Release Notes

  • Improvements
    • Improved when_all to consistently handle void-returning tasks by including them in the result tuple as std::monostate values, preserving input indices and enabling uniform tuple aggregation for mixed task combinations.
    • Enhanced type utilities for better void handling across asynchronous operations.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Warning

Rate limit exceeded

@mvandeberg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 19 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8981cb67-0c73-4e58-a071-de74b2491f2b

📥 Commits

Reviewing files that changed from the base of the PR and between 0cea4bb and 0a0bb31.

⛔ Files ignored due to path filters (4)
  • doc/modules/ROOT/pages/4.coroutines/4f.composition.adoc is excluded by !**/doc/**
  • doc/unlisted/coroutines-when-all.adoc is excluded by !**/doc/**
  • doc/unlisted/library-when-all.adoc is excluded by !**/doc/**
  • test/unit/when_all.cpp is excluded by !**/test/**
📒 Files selected for processing (4)
  • example/parallel-fetch/parallel_fetch.cpp
  • include/boost/capy/detail/void_to_monostate.hpp
  • include/boost/capy/when_all.hpp
  • include/boost/capy/when_any.hpp
📝 Walkthrough

Walkthrough

The PR extracts a shared void_to_monostate_t type alias into a dedicated detail header and updates when_all to replace void-filtering logic with monostate replacement, preserving task-index-to-result-index mapping across both when_any and when_all APIs.

Changes

Cohort / File(s) Summary
New Detail Header
include/boost/capy/detail/void_to_monostate.hpp
Introduces void_to_monostate_t template alias that conditionally maps void to std::monostate while passing through other types unchanged, guarded by <type_traits> and <variant> includes.
when_all Result Type Refactor
include/boost/capy/when_all.hpp
Replaces non_void_tuple_t with when_all_result_t to return std::tuple<void_to_monostate_t<Ts>...>. Updates result_holder<void> to provide get() returning std::monostate. Simplifies extraction logic to always construct tuples with index-preserving monostate values for void results.
when_any Header Consolidation
include/boost/capy/when_any.hpp
Removes inline void_to_monostate_t definition and adds include of new shared detail header to source the alias from the centralized location.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A monostate hops where void once hid,
Indices now map to tasks as they did!
No filtering, just placeholder replacements—
Tuples aligned with crystal-clear tracements.
When all tasks done, order stays put, behold! 🌟

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Replace void filtering with monostate in when_all' accurately describes the main change: switching from void filtering to monostate in the when_all implementation.
Linked Issues check ✅ Passed The pull request implements all required changes from issue #204: introduces void_to_monostate_t type alias, updates when_all to use monostate instead of filtering void, modifies result_holder to return monostate, and updates when_any to use the shared type alias.
Out of Scope Changes check ✅ Passed All changes directly support the stated objective of replacing void filtering with monostate in when_all to preserve task-index-to-result-index mapping; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mvandeberg mvandeberg force-pushed the pr/204-when-all-void branch from 6d5fd12 to 0cea4bb Compare March 11, 2026 22:07
@cppalliance-bot
Copy link

cppalliance-bot commented Mar 11, 2026

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

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

2026-03-11 22:28:27 UTC

@mvandeberg mvandeberg force-pushed the pr/204-when-all-void branch from 0cea4bb to 0a0bb31 Compare March 11, 2026 22:21
@cppalliance-bot
Copy link

cppalliance-bot commented Mar 11, 2026

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

Build time: 2026-03-11 22:36:59 UTC

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.36%. Comparing base (55efc7f) to head (0a0bb31).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #227      +/-   ##
===========================================
- Coverage    92.41%   92.36%   -0.05%     
===========================================
  Files          162      162              
  Lines         8854     8854              
===========================================
- Hits          8182     8178       -4     
- Misses         672      676       +4     
Flag Coverage Δ
linux 92.33% <ø> (-0.05%) ⬇️

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

Files with missing lines Coverage Δ
include/boost/capy/when_all.hpp 97.95% <100.00%> (ø)
include/boost/capy/when_any.hpp 99.31% <ø> (ø)

... 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 55efc7f...0a0bb31. 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 18c30d2 into cppalliance:develop Mar 11, 2026
39 of 40 checks passed
@mvandeberg mvandeberg deleted the pr/204-when-all-void branch March 11, 2026 23:20
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.

when_all: replace void filtering with monostate to preserve task-index-to-result-index mapping

2 participants