Skip to content

Introduce exec::function<...>#2040

Merged
ericniebler merged 48 commits into
NVIDIA:mainfrom
ispeters:frame_allocator
May 6, 2026
Merged

Introduce exec::function<...>#2040
ericniebler merged 48 commits into
NVIDIA:mainfrom
ispeters:frame_allocator

Conversation

@ispeters
Copy link
Copy Markdown
Contributor

This PR proposes a new type-erased sender named exec::function. There's an in-code comment giving a bunch of examples, but a simple example is:

exec::function<int(int)> fn(42, [](int i) { return ex::just(i); });

auto [result] = ex::sync_wait(std::move(fn)).value();

assert(result == 42);

There are a bunch of TODOs left, including lots of tests that are missing, but the API is ready to collect early feedback. If this looks like a promising direction, I intend to write a paper for Brno proposing this type for inclusion in C++29.

Loading
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