Skip to content

Conversation

@kirkshoop
Copy link
Contributor

This is a seminal event. flat_map (aka map-merge or transform-merge)
can be composed from transform_each and merge_each.
flat_map is the root of all async sequence algorithms.

In other libraries merge has the problem of unbounded allocations.
This merge_each does zero allocations.

This merge_each also supports bulk processing in a more natural form.
each value can be running in parallel on different execution contexts.
A future fork adaptor would take a sequence and fork portions of the
sequence into separate sequences on separate schedulers. Then a
merge_each would gather all the result values into a new sequence.
Adding a continue_each_on after merge_each using a strand scheduler
would remove all the parallel completions by queueing the result values and
emitting them one at a time.


merge_each is a sequence adaptor that takes a sequence of nested
sequences and merges all the nested values from all the nested
sequences into a single output sequence.

the first error encountered will trigger a stop request for all
active operations. The error is stored and is emitted only after
all the active operations have completed.

If the error was emitted from an item, a new item is emitted
at the end to deliver the stored error.

any nested sequence or nested value that completes with
set_stopped will not cause any other operations to be stopped.
This allows individual nested sequences to be stopped without
breaking the merge of the remaining sequences.

- add `__debug_sequence_sender`
- add `__well_formed_sequence_sender`
- add static-member-fn support to `get_item_types`
- add static-member-fn support to `subscribe`
- add support for `STDEXEC_ENABLE_EXTRA_TYPE_CHECKING`
- add `__well_formed_sequence_sender` constraint
- add `__mexception` overloads for `get_item_types`
- remove constraints that were causing SFINAE that would skip the debug info
each input sequence may be on a different scheduler.
The merged items will invoke `set_next` on the receiver from all of the contexts.
Depending on the schedulers in play, the calls to `set_next` may overlap in parallel.
merge_each is a sequence adaptor that takes a sequence of nested
sequences and merges all the nested values from all the nested
sequences into a single output sequence.

the first error encountered will trigger a stop request for all
active operations. The error is stored and is emitted only after
all the active operations have completed.

If the error was emitted from an item, a new item is emitted
at the end to deliver the stored error.

any nested sequence or nested value that completes with
set_stopped will not cause any other operations to be stopped.
This allows individual nested sequences to be stopped without
breaking the merge of the remaining sequences.
@copy-pr-bot
Copy link

copy-pr-bot bot commented Oct 13, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ericniebler
Copy link
Collaborator

/ok to test 3f1ba21

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.

2 participants