Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions include/stdexec/execution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2704,36 +2704,40 @@ namespace stdexec {
}
};

inline constexpr struct __just_t : __just_impl<__just_t, set_value_t> {
struct just_t : __just_impl<just_t, set_value_t> {
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<just_t>(__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<just_error_t, set_error_t> {
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<just_error_t>(__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<just_stopped_t, set_stopped_t> {
STDEXEC_DETAIL_CUDACC_HOST_DEVICE //
auto
operator()() const noexcept {
return make_sender_expr<__just_stopped_t>(__decayed_tuple<>());
return make_sender_expr<just_stopped_t>(__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]
Expand Down
8 changes: 4 additions & 4 deletions test/exec/test_variant_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ template <class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;

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<just_t, just_int_t> variant{just()};
variant_sender<just_void_t, just_int_t> variant{just()};
CHECK(variant.index() == 0);
}

TEST_CASE("variant_sender - using an overloaded then adaptor", "[types][variant_sender]") {
variant_sender<just_t, just_int_t> variant = just();
variant_sender<just_void_t, just_int_t> variant = just();
int index = -1;
STATIC_REQUIRE(sender<variant_sender<just_t, just_int_t>>);
STATIC_REQUIRE(sender<variant_sender<just_void_t, just_int_t>>);
sync_wait(variant | then([&index](auto... xs) { index = sizeof...(xs); }));
CHECK(index == 0);

Expand Down