Refactor variadic when_any to return positional variant#190
Refactor variadic when_any to return positional variant#190mvandeberg wants to merge 1 commit intocppalliance:developfrom
Conversation
Replace pair<size_t, deduplicated_variant> return type with a plain std::variant that preserves one alternative per input task. This makes variant::index() the single mechanism for identifying the winner and eliminates the type-deduplication machinery (unique_variant_t and friends). Internally, variant construction uses in_place_index<I> instead of in_place_type<T> to support same-type alternatives. The homogeneous range overloads (vector) are unchanged.
📝 WalkthroughWalkthroughThis PR refactors the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
An automated preview of the documentation is available at https://190.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-02 22:27:41 UTC |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
include/boost/capy/when_any.hpp (1)
368-372: Use non-Doxygen comments fordetail::helper documentation.These comments are attached to implementation symbols in
detail::; please avoid/** ... */javadoc style here to keep generated API docs focused on public surface.As per coding guidelines: "Don't document detail:: or implementation symbols in javadoc".Proposed doc-only adjustment
-/** Indexed overload for heterogeneous when_any (compile-time index). - - Uses compile-time index I for variant construction via in_place_index. - Called from when_any_launcher::launch_one<I>(). -*/ +// Indexed overload for heterogeneous when_any (compile-time index). +// Uses compile-time index I for variant construction via in_place_index. +// Called from when_any_launcher::launch_one<I>(). template<std::size_t I, IoAwaitable Awaitable, typename StateType> when_any_runner<StateType> make_when_any_runner(Awaitable inner, StateType* state) -/** Runtime-index overload for homogeneous when_any (range path). +// Runtime-index overload for homogeneous when_any (range path). - Uses requires-expressions to detect state capabilities: - - set_winner_void(): for heterogeneous void tasks (stores monostate) - - set_winner_result(): for non-void tasks - - Neither: for homogeneous void tasks (no result storage) -*/ +// Uses requires-expressions to detect state capabilities: +// - set_winner_void(): for heterogeneous void tasks (stores monostate) +// - set_winner_result(): for non-void tasks +// - Neither: for homogeneous void tasks (no result storage) template<IoAwaitable Awaitable, typename StateType> when_any_runner<StateType> make_when_any_runner(Awaitable inner, StateType* state, std::size_t index)Also applies to: 401-407
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@include/boost/capy/when_any.hpp` around lines 368 - 372, The block comment above the indexed overload uses Doxygen/Javadoc style (/** ... */) for internal detail symbols; replace those doc-style comments with non-Doxygen comments (e.g., // or /* ... */) so implementation helpers in detail:: (including the comment that references when_any_launcher::launch_one<I>() and the other similar blocks around the lines noted) are not picked up as public API docs—update both the comment at the indexed overload and the similar comment block that covers lines 401-407 to use ordinary comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@include/boost/capy/when_any.hpp`:
- Around line 368-372: The block comment above the indexed overload uses
Doxygen/Javadoc style (/** ... */) for internal detail symbols; replace those
doc-style comments with non-Doxygen comments (e.g., // or /* ... */) so
implementation helpers in detail:: (including the comment that references
when_any_launcher::launch_one<I>() and the other similar blocks around the lines
noted) are not picked up as public API docs—update both the comment at the
indexed overload and the similar comment block that covers lines 401-407 to use
ordinary comments.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
doc/modules/ROOT/pages/4.coroutines/4f.composition.adocis excluded by!**/doc/**doc/unlisted/coroutines-when-any.adocis excluded by!**/doc/**test/unit/when_any.cppis excluded by!**/test/**
📒 Files selected for processing (2)
example/when-any-cancellation/when_any_cancellation.cppinclude/boost/capy/when_any.hpp
|
GCOVR code coverage report https://190.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-03-02 22:39:17 UTC |
Replace pair<size_t, deduplicated_variant> return type with a plain std::variant that preserves one alternative per input task. This makes variant::index() the single mechanism for identifying the winner and eliminates the type-deduplication machinery (unique_variant_t and friends). Internally, variant construction uses in_place_index instead of in_place_type to support same-type alternatives.
The homogeneous range overloads (vector) are unchanged.
Summary by CodeRabbit
API Updates
when_anyreturn value structure has been restructured.Documentation
when_anyusage patterns.