compat.beman-execution
#includeBeman P2300 sender/receiver execution library (C++23 headers)
#include <beman/execution.hpp>
mcpp add compat.beman-execution@0.3.0
Usage
From this repository's own test project — built and run by CI, not written for the website.
#include <beman/execution.hpp>
#include <beman/stop_token.hpp>
import std;
namespace ex = beman::execution;
int main() {
bool ok = true;
auto check = [&](bool condition, const char* message) {
if (!condition) {
std::cerr << "FAIL: " << message << '\n';
ok = false;
}
};
auto value = ex::sync_wait(ex::just(20) | ex::then([](int n) { return n * 2 + 2; }));
check(value.has_value() && std::get<0>(*value) == 42, "just/then transforms a value");
auto joined = ex::sync_wait(ex::when_all(ex::just(17), ex::just(25)));
check(joined.has_value() && std::get<0>(*joined) + std::get<1>(*joined) == 42,
"when_all delivers both values");
bool ran = false;
auto stopped = ex::sync_wait(ex::just_stopped()
| ex::then([&] { ran = true; })
// …
tests/examples/beman-execution/tests/execution.cpp · project tests/examples/beman-execution
Build
- targets
beman_execution_headers (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
*/include
Sources (1)
mcpp_generated/beman_execution_anchor.c
Generated files
mcpp_generated/beman_execution_anchor.c
Versions
| Version | Platforms | Mirrors | sha256 |
|---|---|---|---|
0.3.0 latest |
LinuxWindowsmacOS | source | 0d39803334ac… |