From ba691c8980a51473bbccb2f540b5deccd24a1d5d Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Sun, 1 Oct 2023 17:33:47 -0700 Subject: [PATCH] give the just senders proper tag types --- include/stdexec/execution.hpp | 28 ++++++++++++++++------------ test/exec/test_variant_sender.cpp | 8 ++++---- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/stdexec/execution.hpp b/include/stdexec/execution.hpp index 66bb8f604..f3329d456 100644 --- a/include/stdexec/execution.hpp +++ b/include/stdexec/execution.hpp @@ -2704,36 +2704,40 @@ namespace stdexec { } }; - inline constexpr struct __just_t : __just_impl<__just_t, set_value_t> { + struct just_t : __just_impl { template <__movable_value... _Ts> STDEXEC_DETAIL_CUDACC_HOST_DEVICE // auto operator()(_Ts&&... __ts) const noexcept((__nothrow_decay_copyable<_Ts> && ...)) { - return make_sender_expr<__just_t>(__decayed_tuple<_Ts...>{(_Ts&&) __ts...}); + return make_sender_expr(__decayed_tuple<_Ts...>{(_Ts&&) __ts...}); } - } just{}; + }; - inline constexpr struct __just_error_t : __just_impl<__just_error_t, set_error_t> { + struct just_error_t : __just_impl { template <__movable_value _Error> STDEXEC_DETAIL_CUDACC_HOST_DEVICE // auto operator()(_Error&& __err) const noexcept(__nothrow_decay_copyable<_Error>) { - return make_sender_expr<__just_error_t>(__decayed_tuple<_Error>{(_Error&&) __err}); + return make_sender_expr(__decayed_tuple<_Error>{(_Error&&) __err}); } - } just_error{}; + }; - inline constexpr struct __just_stopped_t : __just_impl<__just_stopped_t, set_stopped_t> { + struct just_stopped_t : __just_impl { STDEXEC_DETAIL_CUDACC_HOST_DEVICE // auto operator()() const noexcept { - return make_sender_expr<__just_stopped_t>(__decayed_tuple<>()); + return make_sender_expr(__decayed_tuple<>()); } - } just_stopped{}; + }; } - using __just::just; - using __just::just_error; - using __just::just_stopped; + using __just::just_t; + using __just::just_error_t; + using __just::just_stopped_t; + + inline constexpr just_t just {}; + inline constexpr just_error_t just_error {}; + inline constexpr just_stopped_t just_stopped {}; ///////////////////////////////////////////////////////////////////////////// // [execution.execute] diff --git a/test/exec/test_variant_sender.cpp b/test/exec/test_variant_sender.cpp index c51a105d8..72220725d 100644 --- a/test/exec/test_variant_sender.cpp +++ b/test/exec/test_variant_sender.cpp @@ -30,17 +30,17 @@ template overloaded(Ts...) -> overloaded; using just_int_t = decltype(just(0)); -using just_t = decltype(just()); +using just_void_t = decltype(just()); TEST_CASE("variant_sender - default constructible", "[types][variant_sender]") { - variant_sender variant{just()}; + variant_sender variant{just()}; CHECK(variant.index() == 0); } TEST_CASE("variant_sender - using an overloaded then adaptor", "[types][variant_sender]") { - variant_sender variant = just(); + variant_sender variant = just(); int index = -1; - STATIC_REQUIRE(sender>); + STATIC_REQUIRE(sender>); sync_wait(variant | then([&index](auto... xs) { index = sizeof...(xs); })); CHECK(index == 0);