Skip to content

Commit 30371f5

Browse files
committed
added a simple example creating a sender
1 parent 5b830fe commit 30371f5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
# cmake-format: on
55

6-
list(APPEND EXAMPLES when_all-cancel stop_token stopping allocator)
6+
list(APPEND EXAMPLES sender-demo when_all-cancel stop_token stopping allocator)
77

88
foreach(EXAMPLE ${EXAMPLES})
99
set(EXAMPLE_TARGET ${TARGET_PREFIX}.examples.${EXAMPLE})

examples/just_stopped.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <beman/execution26/execution.hpp>
2+
namespace ex = beman::execution26;
3+
4+
struct receiver {
5+
using receiver_concept = ex::receiver_t;
6+
auto set_value(auto&&...) noexcept -> void {}
7+
auto set_error(auto&&) noexcept -> void {}
8+
auto set_stopped() noexcept -> void {}
9+
};
10+
11+
int main() {
12+
// ex::sync_wait(ex::just_stopped() | ex::then([]{}));
13+
auto then = ex::just_stopped() | ex::then([] {});
14+
static_assert(std::same_as<void, decltype(ex::get_completion_signatures(then, ex::empty_env()))>);
15+
16+
ex::connect(ex::just_stopped() | ex::then([] {}), receiver{});
17+
}

0 commit comments

Comments
 (0)