diff --git a/examples/algorithms/retry.hpp b/examples/algorithms/retry.hpp index 2fc3e1c6f..c4d34488f 100644 --- a/examples/algorithms/retry.hpp +++ b/examples/algorithms/retry.hpp @@ -134,7 +134,7 @@ struct _retry_sender using _value = stdexec::completion_signatures; template - static consteval auto get_completion_signatures() -> stdexec::transform_completion_signatures< + static consteval auto get_completion_signatures() -> stdexec::__transform_completion_signatures_t< stdexec::completion_signatures_of_t, stdexec::completion_signatures, _value, diff --git a/examples/algorithms/then.hpp b/examples/algorithms/then.hpp index 4d3f33dcd..4288a0bee 100644 --- a/examples/algorithms/then.hpp +++ b/examples/algorithms/then.hpp @@ -70,7 +70,7 @@ struct _then_sender stdexec::completion_signatures)>; template - using _completions_t = stdexec::transform_completion_signatures< + using _completions_t = stdexec::__transform_completion_signatures_t< stdexec::completion_signatures_of_t, stdexec::completion_signatures, _set_value_t>; diff --git a/include/exec/asio/use_sender.hpp b/include/exec/asio/use_sender.hpp index 302e53899..d276f0ac4 100644 --- a/include/exec/asio/use_sender.hpp +++ b/include/exec/asio/use_sender.hpp @@ -166,9 +166,9 @@ namespace experimental::execution::asio template using completion_signatures = - ::STDEXEC::transform_completion_signatures, - transform_set_value_t>; + ::STDEXEC::__transform_completion_signatures_t, + transform_set_value_t>; template struct sender diff --git a/include/exec/async_scope.hpp b/include/exec/async_scope.hpp index e8873b6a0..49de3041b 100644 --- a/include/exec/async_scope.hpp +++ b/include/exec/async_scope.hpp @@ -444,7 +444,7 @@ namespace experimental::execution using __decay_error_t = completion_signatures)>; template - using __future_completions_t = transform_completion_signatures_of< + using __future_completions_t = __transform_completion_signatures_of_t< _Sender, __env_t<_Env>, completion_signatures, diff --git a/include/exec/completion_signatures.hpp b/include/exec/completion_signatures.hpp index 0a10f23a2..3ab764b15 100644 --- a/include/exec/completion_signatures.hpp +++ b/include/exec/completion_signatures.hpp @@ -58,19 +58,25 @@ namespace experimental::execution //! by combining explicitly provided signature types with those deduced from pointer //! arguments. //! - //! @tparam ExplicitSigs Explicitly specified completion signature types. - //! @tparam DeducedSigs Completion signature types to be deduced from the function arguments. - //! @param unnamed Pointer arguments (unused) used for type deduction of DeducedSigs. + //! \tparam ExplicitSigs Explicitly specified completion signature types. Must be a pack + //! of function types, the returns types of which must be one of + //! \c set_value_t, \c set_error_t, or \c set_stopped_t. + //! \tparam DeducedSigs Completion signature types to be deduced from the function + //! arguments. + //! \param unnamed Pointer arguments (unused) for type deduction of + //! \c DeducedSigs. Must be a pack of function pointer types, the + //! returns types of which must be one of \c set_value_t, + //! \c set_error_t, or \c set_stopped_t. //! - //! @return An instance of `STDEXEC::completion_signatures` containing the combined + //! \return An instance of \c STDEXEC::completion_signatures containing the combined //! signatures. //! - //! @note This is a `consteval` function, meaning it is only callable in constant evaluation - //! contexts (compile-time). It always returns a default-constructed instance of the result - //! type. + //! \note This is a \c consteval function, meaning it is only callable in constant + //! evaluation contexts (compile-time). It always returns a default-constructed + //! instance of the result type. //! - //! @note The function uses pointer arguments for type deduction without requiring actual object - //! instances. + //! \note The function uses pointer arguments for type deduction without requiring + //! actual object instances. template [[nodiscard]] consteval auto make_completion_signatures(DeducedSigs*...) noexcept @@ -95,33 +101,134 @@ namespace experimental::execution ////////////////////////////////////////////////////////////////////////////////////////////////// // transform_completion_signatures + template using keep_completion = STDEXEC::__keep_completion<_SetTag>; using ignore_completion = STDEXEC::__ignore_completion; - template - using transform_arguments = STDEXEC::__transform_arguments<_SetTag, _Fn, _AlgoTag...>; + template class _Fn, class... _AlgoTag> + using transform_arguments = + STDEXEC::__transform_arguments<_SetTag, STDEXEC::__q1<_Fn>, _AlgoTag...>; template using decay_arguments = STDEXEC::__decay_arguments<_SetTag, _AlgoTag...>; - template , - class _ErrorFn = keep_completion, - class _StoppedFn = keep_completion, - class _ExtraSigs = STDEXEC::completion_signatures<>> - consteval auto transform_completion_signatures(_Completions, - _ValueFn __value_fn = {}, - _ErrorFn __error_fn = {}, - _StoppedFn __stopped_fn = {}, - _ExtraSigs = {}) + //! \brief Transforms completion signatures using provided transformation functions. + //! + //! This consteval function transforms a set of completion signatures by applying + //! custom transformation functions to value, error, and stopped completion cases. + //! The result can be augmented with additional extra signatures. + //! + //! \tparam Completions The input completion signatures to transform. Must be a + //! specialization of \c STDEXEC::completion_signatures. + //! \tparam ValueFn Function object that transforms set_value_t completions. + //! Defaults to keep_completion. + //! \tparam ErrorFn Function object that transforms set_error_t completions. + //! Defaults to keep_completion. + //! \tparam StoppedFn Function object that transforms set_stopped_t completions. + //! Defaults to keep_completion. + //! \tparam ExtraSigs Additional completion signatures to append to the result. + //! Must be a specialization of \c STDEXEC::completion_signatures. + //! Defaults to \c STDEXEC::completion_signatures(). + //! + //! \param completions The input completion signatures object. + //! \param value_fn Value transformation function instance. + //! \param error_fn Error transformation function instance. + //! \param stopped_fn Stopped transformation function instance. + //! \param extra_sigs Extra signatures to append to the result. + //! + //! \return A transformed completion_signatures object combining the transformed + //! input signatures with the extra signatures. + //! + //! \par Example + //! + //! The following example demonstrates how to use \c transform_completion_signatures + //! to compute the completion signatures of the \c then sender. + //! + //! \code{.cpp} + //! namespace ex = STDEXEC; + //! + //! // A helper function to transform the value types of the child sender into the value + //! // types of the then sender. + //! template + //! consteval auto _transform_values() + //! { + //! if constexpr (!std::invocable) + //! { + //! // If Fn cannot be invoked with the given arguments, produce a compile-time + //! // error. + //! return exec::throw_compile_time_error< + //! WHAT(FUNCTION_IS_NOT_CALLABLE_WITH_THE_GIVEN_ARGUMENTS), + //! WHERE(IN_ALGORITHM, then_t), + //! WITH_FUNCTION(Fn), + //! WITH_ARGUMENTS(Args...)>(); + //! } + //! else + //! { + //! // transform the value types of the child sender into the value types of the + //! // then sender by applying Fn to them. + //! using result_t = std::invoke_result_t; + //! constexpr bool is_void = std::is_void_v; + //! constexpr bool nothrow = std::is_nothrow_invocable_v; + //! if constexpr (is_void && nothrow) + //! { + //! return ex::completion_signatures(); + //! } + //! else if constexpr (is_void && !nothrow) + //! { + //! return ex::completion_signatures(); + //! } + //! else if constexpr (!is_void && nothrow) + //! { + //! return ex::completion_signatures(); + //! } + //! else /* !is_void && !nothrow */ + //! { + //! return ex::completion_signatures(); + //! } + //! } + //! } + //! + //! template + //! struct then_sender + //! { + //! using sender_concept = ex::sender_t; + //! + //! template + //! static consteval auto get_completion_signatures() + //! { + //! // Compute the completion signatures of the child sender, and then transform + //! // them into the completion signatures of the `then` sender. + //! auto child_completions = exec::get_child_completion_signatures(); + //! auto value_fn = []() { return _transform_values(); }; + //! + //! return exec::transform_completion_signatures(child_completions, value_fn); + //! } + //! + //! // ... + //! }; + //! \endcode + //! + //! \note This function is evaluated at compile-time (consteval). + template , + class ErrorFn = keep_completion, + class StoppedFn = keep_completion, + class ExtraSigs = STDEXEC::completion_signatures<>> + consteval auto transform_completion_signatures(Completions, + ValueFn value_fn = {}, + ErrorFn error_fn = {}, + StoppedFn stopped_fn = {}, + ExtraSigs = {}) { - return STDEXEC::__transform_completion_signatures(_Completions{}, - __value_fn, - __error_fn, - __stopped_fn, - _ExtraSigs{}); + return STDEXEC::__transform_completion_signatures(Completions{}, + value_fn, + error_fn, + stopped_fn, + ExtraSigs{}); } } // namespace experimental::execution diff --git a/include/exec/detail/shared.hpp b/include/exec/detail/shared.hpp index 96751e24c..44b490349 100644 --- a/include/exec/detail/shared.hpp +++ b/include/exec/detail/shared.hpp @@ -133,13 +133,13 @@ namespace experimental::execution::__shared //////////////////////////////////////////////////////////////////////////////////////// template using __result_variant_t = - __transform_completion_signatures_t<__completion_signatures_of_t<_CvSender, _Env>, - __mbind_front_q<__decayed_tuple, set_value_t>::__f, - __mbind_front_q<__decayed_tuple, set_error_t>::__f, - __tuple, - __munique<__qq<__variant>>::__f, - __tuple, - __tuple>; + __transform_reduce_completion_signatures_t<__completion_signatures_of_t<_CvSender, _Env>, + __mbind_front_q<__decayed_tuple, set_value_t>::__f, + __mbind_front_q<__decayed_tuple, set_error_t>::__f, + __tuple, + __munique<__qq<__variant>>::__f, + __tuple, + __tuple>; //////////////////////////////////////////////////////////////////////////////////////// template @@ -461,12 +461,12 @@ namespace experimental::execution::__shared }; template - using __make_completions_t = __try_make_completion_signatures< + using __make_completions_t = __transform_completion_signatures_of_t< _CvSender, __env_t<_Env>, completion_signatures), set_stopped_t()>, - __mtransform<_Cv, __mcompose<__qq, __qf>>, - __mtransform<_Cv, __mcompose<__qq, __qf>>>; + __mtransform<_Cv, __mcompose<__qq, __qf>>::template __f, + __mtransform<_Cv, __mcompose<__qq, __qf>>::template __f>; // split completes with const T&. ensure_started completes with T&&. template diff --git a/include/exec/into_tuple.hpp b/include/exec/into_tuple.hpp index 8bccb1c31..2a7fd6f7c 100644 --- a/include/exec/into_tuple.hpp +++ b/include/exec/into_tuple.hpp @@ -53,7 +53,7 @@ namespace experimental::execution STDEXEC::completion_signatures; template - using __completions_t = transform_completion_signatures< + using __completions_t = __transform_completion_signatures_t< __completion_signatures_of_t<_Sender, _Env...>, __minvoke_q<__tuple_completions_t, __result_tuple_t<_Sender, _Env...>>, __mconst>::__f>; diff --git a/include/exec/just_from.hpp b/include/exec/just_from.hpp index 953b0b5fc..7f898091e 100644 --- a/include/exec/just_from.hpp +++ b/include/exec/just_from.hpp @@ -115,7 +115,7 @@ namespace experimental::execution { template using __f = STDEXEC::__concat_completion_signatures_t, - STDEXEC::__eptr_completion>; + STDEXEC::__eptr_completion_t>; }; template diff --git a/include/exec/libdispatch_queue.hpp b/include/exec/libdispatch_queue.hpp index 3a7f79d7b..a77eefcb1 100644 --- a/include/exec/libdispatch_queue.hpp +++ b/include/exec/libdispatch_queue.hpp @@ -258,14 +258,14 @@ namespace experimental::execution STDEXEC::__mbind_front_q, STDEXEC::__q>::value, STDEXEC::completion_signatures<>, - STDEXEC::__eptr_completion>; + STDEXEC::__eptr_completion_t>; template using set_value_t = STDEXEC::completion_signatures...)>; template - using _completions_t = STDEXEC::transform_completion_signatures< + using _completions_t = STDEXEC::__transform_completion_signatures_t< STDEXEC::__completion_signatures_of_t, Env...>, with_error_invoke_t, Env...>, set_value_t>; diff --git a/include/exec/materialize.hpp b/include/exec/materialize.hpp index 397eecc56..f57b089ef 100644 --- a/include/exec/materialize.hpp +++ b/include/exec/materialize.hpp @@ -95,7 +95,7 @@ namespace experimental::execution using __materialize_error = completion_signatures; template - using __completions_t = __transform_completion_signatures_t< + using __completions_t = __transform_reduce_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t<_Self, _Sender>, _Env...>, __materialize_value, __materialize_error, @@ -202,7 +202,7 @@ namespace experimental::execution using __dematerialize_value = completion_signatures<__decay_t<_Tag>(_Args...)>; template - using __completions_t = transform_completion_signatures< + using __completions_t = __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t<_Self, _Sender>, _Env...>, completion_signatures<>, __mtry_q<__dematerialize_value>::template __f>; diff --git a/include/exec/repeat_n.hpp b/include/exec/repeat_n.hpp index 1abad7cc1..29fbfa1e9 100644 --- a/include/exec/repeat_n.hpp +++ b/include/exec/repeat_n.hpp @@ -197,15 +197,15 @@ namespace experimental::execution using __error_t = completion_signatures)>; template - using __with_eptr_completion_t = __eptr_completion_unless< + using __with_eptr_completion_t = __eptr_completion_unless_t<__mbool< __cmplsigs::__partitions_of_t< __completion_signatures_of_t<_Sender, _Env...>>::__nothrow_decay_copyable::__errors::value - && (__nothrow_connectable<_Sender, __receiver_archetype<_Env>> && ...)>; + && (__nothrow_connectable<_Sender, __receiver_archetype<_Env>> && ...)>>; template - using __completions_t = STDEXEC::transform_completion_signatures< + using __completions_t = STDEXEC::__transform_completion_signatures_t< __completion_signatures_of_t<_Child &, _Env...>, - STDEXEC::transform_completion_signatures< + STDEXEC::__transform_completion_signatures_t< __completion_signatures_of_t, _Env...>, __with_eptr_completion_t<_Child, _Env...>, __cmplsigs::__default_set_value, diff --git a/include/exec/repeat_until.hpp b/include/exec/repeat_until.hpp index 497ad8f7f..d0ac876b2 100644 --- a/include/exec/repeat_until.hpp +++ b/include/exec/repeat_until.hpp @@ -283,9 +283,9 @@ namespace experimental::execution } else { - constexpr bool __has_nothrow_connect = - (__nothrow_connectable<__child_t, __receiver_archetype<_Env>> || ...); - constexpr auto __eptr_sigs = __eptr_completion_unless<__has_nothrow_connect>(); + using __has_nothrow_connect_t = + __mbool<(__nothrow_connectable<__child_t, __receiver_archetype<_Env>> || ...)>; + constexpr auto __eptr_sigs = __eptr_completion_unless_t<__has_nothrow_connect_t>(); constexpr auto __bouncer_sigs = exec::transform_completion_signatures( get_completion_signatures<__bouncer_t, _Env...>(), exec::ignore_completion()); // drop the set_value_t() completion from the diff --git a/include/exec/sequence.hpp b/include/exec/sequence.hpp index 75c4c5fb9..7c8365962 100644 --- a/include/exec/sequence.hpp +++ b/include/exec/sequence.hpp @@ -258,9 +258,9 @@ namespace experimental::execution } else { - using __env_t = STDEXEC::__mfront>; - using __rcvr_t = STDEXEC::__receiver_archetype<__env_t>; - constexpr bool nothrow = (STDEXEC::__nothrow_connectable && ...); + using __env_t = STDEXEC::__mfront>; + using __rcvr_t = STDEXEC::__receiver_archetype<__env_t>; + constexpr bool __is_nothrow = (STDEXEC::__nothrow_connectable && ...); // The completions of the sequence sender are the error and stopped completions of all the // child senders plus the value completions of the last child sender. @@ -272,7 +272,7 @@ namespace experimental::execution STDEXEC::get_completion_signatures(), exec::ignore_completion())..., STDEXEC::get_completion_signatures, Env...>(), - STDEXEC::__eptr_completion_unless()); + STDEXEC::__eptr_completion_unless_t>()); } } diff --git a/include/exec/sequence/ignore_all_values.hpp b/include/exec/sequence/ignore_all_values.hpp index 3d6a9fce7..66fc279d3 100644 --- a/include/exec/sequence/ignore_all_values.hpp +++ b/include/exec/sequence/ignore_all_values.hpp @@ -249,7 +249,7 @@ namespace experimental::execution }; template - using __result_variant_ = __transform_completion_signatures_t< + using __result_variant_ = __transform_reduce_completion_signatures_t< _Sigs, __mconst<__mlist<>>::__f, __mcompose_q<__mlist, __mbind_front_q<__decayed_tuple, set_error_t>::__f>::__f, diff --git a/include/exec/sequence/merge_each.hpp b/include/exec/sequence/merge_each.hpp index 8a4b04b53..af5c162df 100644 --- a/include/exec/sequence/merge_each.hpp +++ b/include/exec/sequence/merge_each.hpp @@ -659,7 +659,7 @@ namespace experimental::execution template static consteval auto get_completion_signatures() noexcept { - using __result_t = STDEXEC::transform_completion_signatures< + using __result_t = STDEXEC::__transform_completion_signatures_t< STDEXEC::__completion_signatures_of_t<_NestedValueSender, _Env...>, STDEXEC::completion_signatures, STDEXEC::__cmplsigs::__default_set_value, diff --git a/include/exec/static_thread_pool.hpp b/include/exec/static_thread_pool.hpp index 4425a4a65..9bc475370 100644 --- a/include/exec/static_thread_pool.hpp +++ b/include/exec/static_thread_pool.hpp @@ -1266,13 +1266,13 @@ namespace experimental::execution _is_nothrow_bulk_fn, __q<__mand>>::value, completion_signatures<>, - __eptr_completion>; + __eptr_completion_t>; template using _set_value_t = completion_signatures...)>; template - using _completions_t = STDEXEC::transform_completion_signatures< + using _completions_t = STDEXEC::__transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, _with_error_invoke_t<__copy_cvref_t, Env...>, _set_value_t>; diff --git a/include/exec/thread_pool_base.hpp b/include/exec/thread_pool_base.hpp index 98d73a927..22299f82b 100644 --- a/include/exec/thread_pool_base.hpp +++ b/include/exec/thread_pool_base.hpp @@ -377,7 +377,7 @@ namespace experimental::execution STDEXEC::completion_signatures...)>; template - using _completion_signatures_t = STDEXEC::transform_completion_signatures< + using _completion_signatures_t = STDEXEC::__transform_completion_signatures_t< STDEXEC::__completion_signatures_of_t, Env...>, _with_error_invoke_t, _set_value_t>; diff --git a/include/exec/unless_stop_requested.hpp b/include/exec/unless_stop_requested.hpp index 8988a935f..2d6ff219f 100644 --- a/include/exec/unless_stop_requested.hpp +++ b/include/exec/unless_stop_requested.hpp @@ -37,10 +37,10 @@ namespace experimental::execution template using __completions_t = - transform_completion_signatures<__completion_signatures_of_t<_Sender, _Env>, - __if_c<__unstoppable_env<_Env>, - completion_signatures<>, - completion_signatures>>; + __transform_completion_signatures_t<__completion_signatures_of_t<_Sender, _Env>, + __if_c<__unstoppable_env<_Env>, + completion_signatures<>, + completion_signatures>>; template struct __opstate diff --git a/include/exec/when_any.hpp b/include/exec/when_any.hpp index 2e6a7e801..fa31f4dd6 100644 --- a/include/exec/when_any.hpp +++ b/include/exec/when_any.hpp @@ -60,7 +60,7 @@ namespace experimental::execution using __f = __mtry_q<__concat_completion_signatures_t>::__f< __eptr_completion_unless_t<__all_value_args_nothrow_decay_copyable<_CvSenders...>>, completion_signatures, - __transform_completion_signatures_t< + __transform_reduce_completion_signatures_t< __completion_signatures_of_t<_CvSenders, __env_t<_Env>...>, __as_rvalues, __as_error, diff --git a/include/nvexec/multi_gpu_context.cuh b/include/nvexec/multi_gpu_context.cuh index b1c43a86d..704c83f3b 100644 --- a/include/nvexec/multi_gpu_context.cuh +++ b/include/nvexec/multi_gpu_context.cuh @@ -118,8 +118,7 @@ namespace nv::execution template [[nodiscard]] - auto connect(Receiver rcvr) const & noexcept(__nothrow_move_constructible) - -> opstate + auto connect(Receiver rcvr) const & noexcept -> opstate { return opstate(static_cast(rcvr)); } diff --git a/include/nvexec/nvtx.cuh b/include/nvexec/nvtx.cuh index 60e40ea0c..0c5bd4de2 100644 --- a/include/nvexec/nvtx.cuh +++ b/include/nvexec/nvtx.cuh @@ -102,11 +102,7 @@ namespace nv::execution template using receiver_t = receiver; - template - using _completions_t = __try_make_completion_signatures<__copy_cvref_t, Env>; - template <__decays_to Self, STDEXEC::receiver Receiver> - requires receiver_of>> STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this Self&& self, Receiver rcvr) -> stream_opstate_t<__copy_cvref_t, receiver_t, Receiver> { @@ -119,9 +115,9 @@ namespace nv::execution STDEXEC_EXPLICIT_THIS_END(connect) template <__decays_to Self, class Env> - static consteval auto get_completion_signatures() -> _completions_t + static consteval auto get_completion_signatures() { - return {}; + return STDEXEC::get_completion_signatures<__copy_cvref_t, Env>(); } auto get_env() const noexcept -> stream_sender_attrs diff --git a/include/nvexec/stream/algorithm_base.cuh b/include/nvexec/stream/algorithm_base.cuh index 072aa65f9..c5b6a54ab 100644 --- a/include/nvexec/stream/algorithm_base.cuh +++ b/include/nvexec/stream/algorithm_base.cuh @@ -101,7 +101,7 @@ namespace nv::execution::_strm::__algo_range_init_fun using _set_value_t = __minvoke_q<__mfirst, DerivedSender, Range>::template _set_value_t; template - using _completions_t = STDEXEC::transform_completion_signatures< + using _completions_t = STDEXEC::__transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, completion_signatures, __mtry_q<_set_value_t>::template __f>; diff --git a/include/nvexec/stream/bulk.cuh b/include/nvexec/stream/bulk.cuh index 53550f206..3b39d6c40 100644 --- a/include/nvexec/stream/bulk.cuh +++ b/include/nvexec/stream/bulk.cuh @@ -123,7 +123,7 @@ namespace nv::execution::_strm using _set_value_t = completion_signatures; template - using _completion_signatures_t = transform_completion_signatures< + using _completion_signatures_t = __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, _set_error_t, _set_value_t>; @@ -359,7 +359,7 @@ namespace nv::execution::_strm using _set_value_t = completion_signatures; template - using _completion_signatures_t = transform_completion_signatures< + using _completion_signatures_t = __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, _set_error_t, _set_value_t>; diff --git a/include/nvexec/stream/continues_on.cuh b/include/nvexec/stream/continues_on.cuh index 08e89fc7b..a7ee8f260 100644 --- a/include/nvexec/stream/continues_on.cuh +++ b/include/nvexec/stream/continues_on.cuh @@ -245,7 +245,7 @@ namespace nv::execution::_strm STDEXEC_EXPLICIT_THIS_END(connect) template <__decays_to Self, class... Env> - static consteval auto get_completion_signatures() -> transform_completion_signatures< + static consteval auto get_completion_signatures() -> __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, completion_signatures, _trnsfr::value_completions_t, diff --git a/include/nvexec/stream/ensure_started.cuh b/include/nvexec/stream/ensure_started.cuh index f67536c6a..78c610464 100644 --- a/include/nvexec/stream/ensure_started.cuh +++ b/include/nvexec/stream/ensure_started.cuh @@ -389,12 +389,12 @@ namespace nv::execution::_strm using _set_error_t = completion_signatures)>; template - static consteval auto get_completion_signatures() -> __try_make_completion_signatures< + static consteval auto get_completion_signatures() -> __transform_completion_signatures_of_t< Sender, _ensure_started::env_t, completion_signatures, - __q<_set_value_t>, - __q<_set_error_t>> + _set_value_t, + _set_error_t> { return {}; } diff --git a/include/nvexec/stream/launch.cuh b/include/nvexec/stream/launch.cuh index 1f3c98398..35b29e785 100644 --- a/include/nvexec/stream/launch.cuh +++ b/include/nvexec/stream/launch.cuh @@ -118,9 +118,9 @@ namespace nv::execution template using completions_t = - transform_completion_signatures<__completion_signatures_of_t, - completion_signatures, - __mbind_front_q<_set_value_t, Fun>::template __f>; + __transform_completion_signatures_t<__completion_signatures_of_t, + completion_signatures, + __mbind_front_q<_set_value_t, Fun>::template __f>; } // namespace _launch template diff --git a/include/nvexec/stream/let_xxx.cuh b/include/nvexec/stream/let_xxx.cuh index 9a69c1da7..37b8d62b8 100644 --- a/include/nvexec/stream/let_xxx.cuh +++ b/include/nvexec/stream/let_xxx.cuh @@ -85,7 +85,7 @@ namespace nv::execution::_strm struct __tfx_signal_fn { template - using __f = transform_completion_signatures< + using __f = __transform_completion_signatures_t< __completion_signatures_of_t<__minvoke<_mk_result_sender, Args...>, StreamEnv...>, completion_signatures>; }; diff --git a/include/nvexec/stream/schedule_from.cuh b/include/nvexec/stream/schedule_from.cuh index 9b9b814f3..d189e25e4 100644 --- a/include/nvexec/stream/schedule_from.cuh +++ b/include/nvexec/stream/schedule_from.cuh @@ -136,7 +136,7 @@ namespace nv::execution using _set_error_t = completion_signatures)>; template - using _completions_t = transform_completion_signatures< + using _completions_t = __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, completion_signatures, _set_value_t, diff --git a/include/nvexec/stream/split.cuh b/include/nvexec/stream/split.cuh index 25dbbafe8..8b592e21d 100644 --- a/include/nvexec/stream/split.cuh +++ b/include/nvexec/stream/split.cuh @@ -353,16 +353,19 @@ namespace nv::execution::_strm template using _set_error_t = completion_signatures const &)>; - using completion_signatures = __try_make_completion_signatures< - Sender, - STDEXEC::prop, - STDEXEC::completion_signatures, - __q<_set_value_t>, - __q<_set_error_t>>; - - template Receiver> - auto connect(Receiver rcvr) const & noexcept(__nothrow_move_constructible) - -> opstate_t + template + static consteval auto get_completion_signatures() + { + return STDEXEC::__transform_completion_signatures_of_t< + Sender, + STDEXEC::prop, + STDEXEC::completion_signatures, + _set_value_t, + _set_error_t>(); + } + + template + auto connect(Receiver rcvr) const & noexcept -> opstate_t { return opstate_t{static_cast(rcvr), sh_state_}; } diff --git a/include/nvexec/stream/then.cuh b/include/nvexec/stream/then.cuh index 389d6f8e5..80f442222 100644 --- a/include/nvexec/stream/then.cuh +++ b/include/nvexec/stream/then.cuh @@ -165,7 +165,7 @@ namespace nv::execution::_strm using _set_value_t = __set_value_from_t; template - using _completions_t = transform_completion_signatures< + using _completions_t = __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, __error_completions_t, _set_value_t, diff --git a/include/nvexec/stream/upon_error.cuh b/include/nvexec/stream/upon_error.cuh index 813be2b49..f3342a99e 100644 --- a/include/nvexec/stream/upon_error.cuh +++ b/include/nvexec/stream/upon_error.cuh @@ -151,7 +151,7 @@ namespace nv::execution::_strm using _set_error_t = __set_value_from_t; template - using completion_signatures = transform_completion_signatures< + using completion_signatures = __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, completion_signatures, __cmplsigs::__default_set_value, diff --git a/include/nvexec/stream/upon_stopped.cuh b/include/nvexec/stream/upon_stopped.cuh index 959ffe309..a10888a68 100644 --- a/include/nvexec/stream/upon_stopped.cuh +++ b/include/nvexec/stream/upon_stopped.cuh @@ -137,7 +137,7 @@ namespace nv::execution::_strm using receiver_t = _upon_stopped::receiver; template - using completion_signatures = transform_completion_signatures< + using completion_signatures = __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t, Env...>, __with_error_invoke_t<__mbind_front_q<__callable_error_t, upon_stopped_t>, set_stopped_t, diff --git a/include/nvexec/stream/when_all.cuh b/include/nvexec/stream/when_all.cuh index 66a395a54..6f6780dc5 100644 --- a/include/nvexec/stream/when_all.cuh +++ b/include/nvexec/stream/when_all.cuh @@ -88,12 +88,12 @@ namespace nv::execution::_strm requires(valid_child_sender && ...) struct completions<__mlist, Senders...> { - using non_values_t = - __minvoke_q<__concat_completion_signatures_t, - completion_signatures, - transform_completion_signatures<__completion_signatures_of_t, - completion_signatures<>, - __mconst>::__f>...>; + using non_values_t = __minvoke_q< + __concat_completion_signatures_t, + completion_signatures, + __transform_completion_signatures_t<__completion_signatures_of_t, + completion_signatures<>, + __mconst>::__f>...>; using values_t = __minvoke<__mconcat<__qf>, __value_types_t<__completion_signatures_of_t, diff --git a/include/nvexec/stream_context.cuh b/include/nvexec/stream_context.cuh index 14e669b92..05a99d68c 100644 --- a/include/nvexec/stream_context.cuh +++ b/include/nvexec/stream_context.cuh @@ -136,8 +136,7 @@ namespace nv::execution {} template - auto connect(Receiver rcvr) const & noexcept(__nothrow_move_constructible) - -> opstate + auto connect(Receiver rcvr) const & noexcept -> opstate { return opstate(static_cast(rcvr), env_.ctx_); } diff --git a/include/stdexec/__detail/__associate.hpp b/include/stdexec/__detail/__associate.hpp index c22b53013..79b175b2a 100644 --- a/include/stdexec/__detail/__associate.hpp +++ b/include/stdexec/__detail/__associate.hpp @@ -246,7 +246,7 @@ namespace STDEXEC template static consteval auto __get_completion_signatures() // - -> transform_completion_signatures< + -> __transform_completion_signatures_t< __completion_signatures_of_t<__wrap_sender_of_t<_Sender>, _Env...>, completion_signatures> { diff --git a/include/stdexec/__detail/__bulk.hpp b/include/stdexec/__detail/__bulk.hpp index 041071cb6..c0b0410ef 100644 --- a/include/stdexec/__detail/__bulk.hpp +++ b/include/stdexec/__detail/__bulk.hpp @@ -168,10 +168,10 @@ namespace STDEXEC typename __bulk_traits<_AlgoTag>::template __fun_curried<_Fun, _Shape>>, __q<__mand>>, completion_signatures<>, - __eptr_completion>; + __eptr_completion_t>; template - using __completion_signatures = transform_completion_signatures< + using __completion_signatures = __transform_completion_signatures_t< __completion_signatures_of_t<_CvSender, _Env...>, __with_error_invoke_t<_AlgoTag, _Fun, _Shape, _CvSender, _Env...>>; diff --git a/include/stdexec/__detail/__continues_on.hpp b/include/stdexec/__detail/__continues_on.hpp index 809ddcf5c..29daade62 100644 --- a/include/stdexec/__detail/__continues_on.hpp +++ b/include/stdexec/__detail/__continues_on.hpp @@ -64,12 +64,12 @@ namespace STDEXEC template using __completions_impl_t = __mtry_q<__concat_completion_signatures_t>::__f< - __transform_completion_signatures_t<_Completions, - __decay_value_sig, - __decay_error_sig, - set_stopped_t (*)(), - __completion_signature_ptrs_t>, - transform_completion_signatures< + __transform_reduce_completion_signatures_t<_Completions, + __decay_value_sig, + __decay_error_sig, + set_stopped_t (*)(), + __completion_signature_ptrs_t>, + __transform_completion_signatures_t< __completion_signatures_of_t, _Env...>, __eptr_completion_unless_t<__nothrow_decay_copyable_results_t<_Completions>>, __mconst>::__f>>; diff --git a/include/stdexec/__detail/__into_variant.hpp b/include/stdexec/__detail/__into_variant.hpp index d2939a8ac..0f011bf8b 100644 --- a/include/stdexec/__detail/__into_variant.hpp +++ b/include/stdexec/__detail/__into_variant.hpp @@ -50,7 +50,7 @@ namespace STDEXEC completion_signatures; template - using __completions = transform_completion_signatures< + using __completions = __transform_completion_signatures_t< __completion_signatures_of_t<_Sender, _Env...>, __minvoke_q<__variant_completions, __variant_t<_Sender, _Env...>>, __mconst>::__f>; diff --git a/include/stdexec/__detail/__let.hpp b/include/stdexec/__detail/__let.hpp index bdf17961a..716053c64 100644 --- a/include/stdexec/__detail/__let.hpp +++ b/include/stdexec/__detail/__let.hpp @@ -165,18 +165,18 @@ namespace STDEXEC struct __transform_signal_fn { template - static constexpr bool __nothrow_connect_v = + using __nothrow_connect_t = __mbool< __nothrow_decay_copyable<_Args...> && __nothrow_callable<_Fun, __decay_t<_Args>&...> && (__nothrow_connectable<__mcall<__result_sender_fn<_SetTag, _Fun, _JoinEnv2>, _Args...>, __receiver_archetype<_JoinEnv2>> - && ...); + && ...)>; template using __f = __mcall<__mtry_q<__concat_completion_signatures_t>, __completion_signatures_of_t< __mcall<__result_sender_fn<_SetTag, _Fun, _JoinEnv2...>, _Args...>, _JoinEnv2...>, - __eptr_completion_unless<__nothrow_connect_v<_Args...>>>; + __eptr_completion_unless_t<__nothrow_connect_t<_Args...>>>; }; template diff --git a/include/stdexec/__detail/__parallel_scheduler.hpp b/include/stdexec/__detail/__parallel_scheduler.hpp index 6dcb39f3b..cf16ccb8f 100644 --- a/include/stdexec/__detail/__parallel_scheduler.hpp +++ b/include/stdexec/__detail/__parallel_scheduler.hpp @@ -606,7 +606,7 @@ namespace STDEXEC { /// Meta-function that returns the completion signatures of `this`. template - using __completions_t = transform_completion_signatures< + using __completions_t = __transform_completion_signatures_t< __completion_signatures_of_t<__copy_cvref_t<_Self, _Previous>, _Env...>, completion_signatures>; diff --git a/include/stdexec/__detail/__stopped_as_optional.hpp b/include/stdexec/__detail/__stopped_as_optional.hpp index 6eb24b1d4..43e4f49b4 100644 --- a/include/stdexec/__detail/__stopped_as_optional.hpp +++ b/include/stdexec/__detail/__stopped_as_optional.hpp @@ -72,7 +72,7 @@ namespace STDEXEC using _Completions = decltype(__completions); if constexpr (__single_value_sender<__child_of<_Self>, _Env...>) { - return transform_completion_signatures< + return __transform_completion_signatures_t< _Completions, completion_signatures, __set_value_t, diff --git a/include/stdexec/__detail/__task.hpp b/include/stdexec/__detail/__task.hpp index 7151a7bc7..074aef85a 100644 --- a/include/stdexec/__detail/__task.hpp +++ b/include/stdexec/__detail/__task.hpp @@ -178,7 +178,7 @@ namespace STDEXEC using scheduler_type = __minvoke_or_q<__task::__scheduler_type, task_scheduler, _Env>; using stop_source_type = __minvoke_or_q<__task::__stop_source_type, inplace_stop_source, _Env>; using stop_token_type = decltype(__declval().get_token()); - using error_types = __minvoke_or_q<__task::__error_types, __eptr_completion, _Env>; + using error_types = __minvoke_or_q<__task::__error_types, __eptr_completion_t, _Env>; constexpr task(task&& __that) noexcept : __coro_(std::exchange(__that.__coro_, {})) diff --git a/include/stdexec/__detail/__task_scheduler.hpp b/include/stdexec/__detail/__task_scheduler.hpp index 170f24959..e9f732c86 100644 --- a/include/stdexec/__detail/__task_scheduler.hpp +++ b/include/stdexec/__detail/__task_scheduler.hpp @@ -536,7 +536,7 @@ namespace STDEXEC __decay_arguments(), {}, {}, - __eptr_completion()); + __eptr_completion_t()); } [[nodiscard]] diff --git a/include/stdexec/__detail/__then.hpp b/include/stdexec/__detail/__then.hpp index f95feadee..8a59d22f7 100644 --- a/include/stdexec/__detail/__then.hpp +++ b/include/stdexec/__detail/__then.hpp @@ -36,7 +36,7 @@ namespace STDEXEC using __on_not_callable = __mbind_front_q<__callable_error_t, then_t>; template - using __completions_t = transform_completion_signatures< + using __completions_t = __transform_completion_signatures_t< __completion_signatures_of_t<_CvSender, _Env...>, __with_error_invoke_t<__on_not_callable, set_value_t, _Fun, _CvSender, _Env...>, __mbind_front<__mtry_catch_q<__set_value_from_t, __on_not_callable>, _Fun>::template __f>; diff --git a/include/stdexec/__detail/__transform_completion_signatures.hpp b/include/stdexec/__detail/__transform_completion_signatures.hpp index 3860a5e95..cd510f55d 100644 --- a/include/stdexec/__detail/__transform_completion_signatures.hpp +++ b/include/stdexec/__detail/__transform_completion_signatures.hpp @@ -56,9 +56,10 @@ namespace STDEXEC concept __well_formed_completions = bool( __cmplsigs::__well_formed_completions_helper<_Completions>); + ////////////////////////////////////////////////////////////////////////////////////////////////// + // __for_each_completion_signature_t namespace __cmplsigs { - ////////////////////////////////////////////////////////////////////////////////////////////////// template