File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
tests/std/tests/P2300R2_executors_factories Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -5511,6 +5511,35 @@ namespace execution {
55115511 is_nothrow_constructible_v<remove_cvref_t<_Error>, _Error>) {
55125512 return {_STD forward<_Error>(_Err)};
55135513 }
5514+
5515+ struct _Just_done_sender {
5516+ template <template <class...> class _Tuple, template <class...> class _Variant>
5517+ using value_types = _Variant<>;
5518+
5519+ template <template <class...> class _Variant>
5520+ using error_types = _Variant<>;
5521+
5522+ static const constexpr auto sends_done = true;
5523+
5524+ template <receiver _Receiver>
5525+ struct operation_state {
5526+ _Receiver _Rec;
5527+
5528+ friend constexpr void tag_invoke(start_t, operation_state& _State) noexcept {
5529+ _EXEC set_done(_STD move(_State._Rec));
5530+ }
5531+ };
5532+
5533+ template <receiver _Receiver>
5534+ _NODISCARD friend constexpr auto tag_invoke(connect_t, const _Just_done_sender&, _Receiver&& _Rec) noexcept(
5535+ is_nothrow_constructible_v<remove_cvref_t<_Receiver>, _Receiver>) {
5536+ return operation_state<_Receiver>{_STD forward<_Receiver>(_Rec)};
5537+ }
5538+ };
5539+
5540+ _NODISCARD constexpr _Just_done_sender just_done() noexcept {
5541+ return {};
5542+ };
55145543} // namespace execution
55155544#endif // __cpp_lib_executors
55165545_STD_END
Original file line number Diff line number Diff line change @@ -124,6 +124,27 @@ constexpr bool test_just_error() {
124124 return true ;
125125}
126126
127+ constexpr bool test_just_done () {
128+ {
129+ Tracker tracker;
130+ typed_sender auto sender = execution::just_done ();
131+ operation_state auto state = connect (sender, nothrow_receiver<>{tracker});
132+ assert (!tracker.set_done_called );
133+ start (state);
134+ assert (tracker.set_done_called );
135+ }
136+
137+ {
138+ Tracker tracker;
139+ operation_state auto state = connect (execution::just_done (), nothrow_receiver<>{tracker});
140+ assert (!tracker.set_done_called );
141+ start (state);
142+ assert (tracker.set_done_called );
143+ }
144+
145+ return true ;
146+ }
147+
127148int main () {
128149 test_just ();
129150 static_assert (test_just ());
You can’t perform that action at this time.
0 commit comments