mcpp index

beman.execution

import

Beman P2300 sender/receiver execution library (native modules)

import beman.execution;
mcpp add beman.execution@0.3.0

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

import std;
import beman.execution;

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; })
                                | ex::let_stopped([] { return ex::just(-1); }));
// …

tests/examples/beman-execution-module/tests/execution.cpp · 项目 tests/examples/beman-execution-module

构建

modules
beman.execution, beman.execution.detail
targets
beman_execution (lib)
language
c++23
import std
yes
include dirs
*/include

源文件 (2)

  • mcpp_generated/*.cppm
  • mcpp_generated/execution.cpp

版本

版本平台 镜像sha256
0.3.0 最新 LinuxWindowsmacOS 源站 0d39803334ac…