compat.beman-execution
#includeBeman P2300 sender/receiver execution library (C++23 headers)
#include <beman/execution.hpp>
mcpp add compat.beman-execution@0.3.0
用法
來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。
#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 · 專案 tests/examples/beman-execution
建置
- targets
beman_execution_headers (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
*/include
原始檔 (1)
mcpp_generated/beman_execution_anchor.c
產生的檔案
mcpp_generated/beman_execution_anchor.c
版本
| 版本 | 平台 | 鏡像 | sha256 |
|---|---|---|---|
0.3.0 最新 |
LinuxWindowsmacOS | 來源 | 0d39803334ac… |