File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
include/beman/execution/detail Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ struct impls_for<::beman::execution::detail::let_t<Completion>> : ::beman::execu
167167 auto mkop{[&] {
168168 return ::beman::execution::connect (
169169 ::std::apply (::std::move(state.fun),
170- state.args.template emplace<args_t>(::std::forward<Args>(args)...)),
170+ ::std::move( state.args.template emplace<args_t >(::std::forward<Args>(args)...) )),
171171 let_receiver<Receiver, decltype(state.env)>{receiver, state.env });
172172 }};
173173 ::beman::execution::start (
Original file line number Diff line number Diff line change 1313 APPEND
1414 execution_tests
1515 issue-174.test
16+ issue-186.test
1617 exec-scope-counting.test
1718 exec-spawn.test
1819 exec-stop-when.test
Original file line number Diff line number Diff line change 1+ #include < beman/execution/execution.hpp>
2+ #include < cassert>
3+
4+ namespace ex = beman::execution;
5+
6+ namespace {
7+ struct move_only_type {
8+ move_only_type () : val(0 ) {}
9+ explicit move_only_type (int v) : val(v) {}
10+ ~move_only_type () = default ;
11+
12+ move_only_type (const move_only_type&) = delete ;
13+ move_only_type& operator =(const move_only_type&) = delete ;
14+
15+ move_only_type& operator =(move_only_type&&) = default ;
16+ move_only_type (move_only_type&&) = default ;
17+ int val; // NOLINT
18+ };
19+ } // namespace
20+
21+ int main () {
22+ auto snd = ex::just (move_only_type (1 )) //
23+ | ex::then ([](move_only_type v) noexcept { return v.val * 2 ; }) //
24+ | ex::let_value ([](int v) noexcept { return ex::just (v * 3 ); }); // int
25+ auto [ret] = ex::sync_wait (std::move (snd)).value ();
26+ assert (ret == 6 );
27+
28+ // NOTE: Compile time error with move_only_type
29+ auto snd2 = ex::just (move_only_type (1 )) //
30+ | ex::then ([](move_only_type v) noexcept { return move_only_type{v.val * 2 }; }) //
31+ | ex::let_value ([](move_only_type v) noexcept { return ex::just (v.val * 3 ); }); // move_only_type
32+ auto [ret2] = ex::sync_wait (std::move (snd2)).value ();
33+ assert (ret2 == 6 );
34+ }
You can’t perform that action at this time.
0 commit comments