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
102 changes: 37 additions & 65 deletions include/exec/detail/basic_sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#if STDEXEC_USE_MODULES() && !defined(STDEXEC_IN_MODULE_PURVIEW)
import stdexec;
#else
# include "../../stdexec/__detail/__basic_sender.hpp"
# include "../../stdexec/__detail/__meta.hpp"

# include "../../stdexec/__detail/__basic_sender_macros.hpp"
# include "../sequence_senders.hpp"

# include "../../stdexec/__detail/__prologue.hpp"
Expand All @@ -33,48 +29,42 @@ namespace experimental::execution
{
//////////////////////////////////////////////////////////////////////////////
// __seqexpr
template <class...>
struct __basic_sequence_sender
{};

namespace
template <class _Tag, class _Data, class... _Child>
struct __seqexpr : STDEXEC::__tuple<_Tag, _Data, _Child...>
{
template <auto _DescriptorFn>
struct __seqexpr
: STDEXEC::__minvoke<decltype(_DescriptorFn()), STDEXEC::__qq<STDEXEC::__tuple>>
{
using sender_concept = sequence_sender_tag;
using __desc_t = decltype(_DescriptorFn());
using __tag_t = __desc_t::__tag;
using sender_concept = sequence_sender_tag;
using __tag_t = _Tag;
using __data_t = _Data;
using __children_t = STDEXEC::__tuple<_Child...>;

STDEXEC_ATTRIBUTE(always_inline)
static constexpr auto __tag() noexcept -> __tag_t
{
return {};
}
STDEXEC_ATTRIBUTE(always_inline)
static constexpr auto __tag() noexcept -> __tag_t
{
return {};
}

template <class _Self = __seqexpr>
auto get_env() const noexcept -> decltype(_Self::__tag().get_env(*this))
{
static_assert(noexcept(_Self::__tag().get_env(*this)));
return _Self::__tag().get_env(*this);
}
template <class _Self = __seqexpr>
auto get_env() const noexcept -> decltype(_Self::__tag().get_env(*this))
{
static_assert(noexcept(_Self::__tag().get_env(*this)));
return _Self::__tag().get_env(*this);
}

template <class _Self, class... _Env>
static consteval auto get_completion_signatures()
{
static_assert(STDEXEC::__decays_to_derived_from<_Self, __seqexpr>);
return __tag_t::template get_completion_signatures<_Self, _Env...>();
}
template <class _Self, class... _Env>
static consteval auto get_completion_signatures()
{
static_assert(STDEXEC::__decays_to_derived_from<_Self, __seqexpr>);
return __tag_t::template get_completion_signatures<_Self, _Env...>();
}

template <class _Self, class... _Env>
static consteval auto get_item_types()
{
static_assert(STDEXEC::__decays_to_derived_from<_Self, __seqexpr>);
return __tag_t::template get_item_types<_Self, _Env...>();
}
template <class _Self, class... _Env>
static consteval auto get_item_types()
{
static_assert(STDEXEC::__decays_to_derived_from<_Self, __seqexpr>);
return __tag_t::template get_item_types<_Self, _Env...>();
}

// clang-format off
// clang-format off
template <class _Self, STDEXEC::receiver _Receiver>
static constexpr auto __static_subscribe(_Self&& __self, _Receiver __rcvr) STDEXEC_AUTO_RETURN
(
Expand All @@ -92,16 +82,12 @@ namespace experimental::execution
(
__tag_t::subscribe(*this, static_cast<_Receiver&&>(__rcvr))
)
// clang-format on
};

template <class _Tag, class _Data, class... _Child>
STDEXEC_HOST_DEVICE_DEDUCTION_GUIDE __seqexpr(_Tag, _Data, _Child...)
-> __seqexpr<STDEXEC_SEXPR_DESCRIPTOR(_Tag, _Data, _Child...)>;
} // namespace
// clang-format on
};

template <class _Tag, class _Data, class... _Child>
using __seqexpr_t = __seqexpr<STDEXEC_SEXPR_DESCRIPTOR(_Tag, _Data, _Child...)>;
STDEXEC_HOST_DEVICE_DEDUCTION_GUIDE
__seqexpr(_Tag, _Data, _Child...) -> __seqexpr<_Tag, _Data, _Child...>;

namespace __mkseqexpr
{
Expand All @@ -111,32 +97,18 @@ namespace experimental::execution
template <class _Data = STDEXEC::__, class... _Children>
constexpr auto operator()(_Data __data = {}, _Children... __children) const
{
return __seqexpr_t<_Tag, _Data, _Children...>{_Tag(),
static_cast<_Data&&>(__data),
static_cast<_Children&&>(__children)...};
return __seqexpr<_Tag, _Data, _Children...>{_Tag(),
static_cast<_Data&&>(__data),
static_cast<_Children&&>(__children)...};
}
};
} // namespace __mkseqexpr

template <class _Tag, class _Data, class... _Child>
using __basic_sequence_sender_t =
__basic_sequence_sender<_Tag, _Data, STDEXEC::__demangle_t<_Child>...>;

template <class _Tag, class _Domain = STDEXEC::default_domain>
inline constexpr __mkseqexpr::make_sequence_expr_t<_Tag, _Domain> make_sequence_expr{};
} // namespace experimental::execution

namespace exec = experimental::execution;

namespace STDEXEC::__detail
{
template <auto _DescriptorFn>
extern decltype(_DescriptorFn()) __desc_of_v<exec::__seqexpr<_DescriptorFn>>;

template <auto _DescriptorFn>
extern __mtype<__minvoke<decltype(_DescriptorFn()), __q<exec::__basic_sequence_sender_t>>>
__demangle_v<exec::__seqexpr<_DescriptorFn>>;
} // namespace STDEXEC::__detail

# include "../../stdexec/__detail/__epilogue.hpp"
#endif
2 changes: 1 addition & 1 deletion include/exec/detail/shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ namespace experimental::execution::__shared
{
return STDEXEC::__throw_compile_time_error<_WHAT_(_SENDER_TYPE_IS_NOT_DECAY_COPYABLE_),
_WHERE_(_IN_ALGORITHM_, _Tag),
_WITH_PRETTY_SENDER_<_CvChild>>();
_WITH_SENDER_<_CvChild>>();
}
}

Expand Down
8 changes: 4 additions & 4 deletions include/exec/ensure_started.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ namespace experimental::execution
}
else
{
return STDEXEC::transform_sender(
STDEXEC::__make_sexpr<ensure_started_t>(static_cast<_Env&&>(__env),
static_cast<_CvSender&&>(__sndr)),
__env);
return STDEXEC::transform_sender(STDEXEC::__sexpr{ensure_started_t(),
static_cast<_Env&&>(__env),
static_cast<_CvSender&&>(__sndr)},
__env);
}
}

Expand Down
13 changes: 6 additions & 7 deletions include/exec/fork_join.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,9 @@ namespace experimental::execution
}
else
{
return STDEXEC::__throw_compile_time_error<
INVALID_ARGUMENTS_TO_FORK_JOIN,
__children_of<Self, __qq<_WITH_PRETTY_SENDERS_>>,
__fn_t<_WITH_ENVIRONMENT_, Env>...>();
return STDEXEC::__throw_compile_time_error<INVALID_ARGUMENTS_TO_FORK_JOIN,
__children_of<Self, __qq<_WITH_SENDERS_>>,
__fn_t<_WITH_ENVIRONMENT_, Env>...>();
}
}

Expand All @@ -287,9 +286,9 @@ namespace experimental::execution
constexpr auto operator()(Sndr&& sndr, Closures&&... closures) const //
-> STDEXEC::__well_formed_sender auto
{
return STDEXEC::__make_sexpr<fork_join_t>(STDEXEC::__tuple{static_cast<Closures&&>(
closures)...},
static_cast<Sndr&&>(sndr));
return STDEXEC::__sexpr{fork_join_t(),
STDEXEC::__tuple{static_cast<Closures&&>(closures)...},
static_cast<Sndr&&>(sndr)};
}

template <class... Closures>
Expand Down
4 changes: 2 additions & 2 deletions include/exec/into_tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace experimental::execution
__mexception<_WHAT_(_INVALID_ARGUMENT_),
_WHY_(_THE_INPUT_SENDER_MUST_HAVE_AT_EXACTLY_ONE_POSSIBLE_VALUE_COMPLETION_),
_WHERE_(_IN_ALGORITHM_, into_tuple_t),
_WITH_PRETTY_SENDER_<_Sender>,
_WITH_SENDER_<_Sender>,
_WITH_ENVIRONMENT_(_Env)>;

template <class _Sender, class... _Env>
Expand Down Expand Up @@ -113,7 +113,7 @@ namespace experimental::execution
template <sender _Sender>
constexpr auto operator()(_Sender &&__sndr) const
{
return __make_sexpr<into_tuple_t>({}, static_cast<_Sender &&>(__sndr));
return __sexpr{into_tuple_t(), __(), static_cast<_Sender &&>(__sndr)};
}

STDEXEC_ATTRIBUTE(always_inline)
Expand Down
14 changes: 7 additions & 7 deletions include/exec/libdispatch_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace experimental::execution
STDEXEC::_WHERE_(STDEXEC::_IN_ALGORITHM_, STDEXEC::tag_of_t<Sender>),
STDEXEC::_TO_FIX_THIS_ERROR_(
ADD_A_CONTINUES_ON_TRANSITION_TO_THE_LIBDISPATCH_SCHEDULER_BEFORE_THE_BULK_ALGORITHM),
STDEXEC::_WITH_PRETTY_SENDER_<Sender>,
STDEXEC::_WITH_SENDER_<Sender>,
STDEXEC::_WITH_ENVIRONMENT_(Env)>();
}
}
Expand Down Expand Up @@ -323,12 +323,12 @@ namespace experimental::execution
using arg_pack_t = __tuple<Shape, Shape, __decay_t<Args> &...>;
if constexpr (!__decay_copyable<Args...>)
{
return exec::throw_compile_time_error<
_WHAT_(_PREDECESSOR_RESULTS_ARE_NOT_DECAY_COPYABLE_),
_WHERE_(_IN_ALGORITHM_, bulk_tag_t),
_WITH_ARGUMENTS_(Args...),
_WITH_PRETTY_SENDER_<__copy_cvref_t<Self, Sender>>,
_WITH_ENVIRONMENT_(Env...)>();
return exec::throw_compile_time_error<_WHAT_(
_PREDECESSOR_RESULTS_ARE_NOT_DECAY_COPYABLE_),
_WHERE_(_IN_ALGORITHM_, bulk_tag_t),
_WITH_ARGUMENTS_(Args...),
_WITH_SENDER_<__copy_cvref_t<Self, Sender>>,
_WITH_ENVIRONMENT_(Env...)>();
}
else if constexpr (__nothrow_applicable<Fun &, arg_pack_t>
&& __nothrow_decay_copyable<Args...>)
Expand Down
4 changes: 2 additions & 2 deletions include/exec/repeat_n.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ namespace experimental::execution
_WHAT_(_INVALID_ARGUMENT_),
_WHERE_(_IN_ALGORITHM_, repeat_n_t),
_WHY_(_THE_INPUT_SENDER_MUST_HAVE_VOID_VALUE_COMPLETION_),
_WITH_PRETTY_SENDER_<__child_t &>>();
_WITH_SENDER_<__child_t &>>();
},
// transform for set_error completions:
decay_arguments<set_error_t, repeat_n_t>(),
Expand Down Expand Up @@ -260,7 +260,7 @@ namespace experimental::execution
constexpr auto operator()(_Sender &&__sndr, std::size_t __count) const //
-> STDEXEC::__well_formed_sender auto
{
return STDEXEC::__make_sexpr<repeat_n_t>(__count, static_cast<_Sender &&>(__sndr));
return STDEXEC::__sexpr{repeat_n_t(), __count, static_cast<_Sender &&>(__sndr)};
}

STDEXEC_ATTRIBUTE(always_inline)
Expand Down
10 changes: 5 additions & 5 deletions include/exec/repeat_until.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ namespace experimental::execution
_WHAT_(_INVALID_ARGUMENT_),
_WHERE_(_IN_ALGORITHM_, repeat_until_t),
_WHY_(_EXPECTING_A_SENDER_OF_ONE_VALUE_THAT_IS_CONVERTIBLE_TO_BOOL_),
_WITH_PRETTY_SENDER_<_Child>>();
_WITH_SENDER_<_Child>>();
}
else if constexpr ((__is_bool_constant<_Args, false> && ...))
{
Expand Down Expand Up @@ -298,7 +298,7 @@ namespace experimental::execution
if constexpr (__is_dependent)
{
return exec::throw_compile_time_error<dependent_sender_error,
_WITH_PRETTY_SENDER_<__child_t>>();
_WITH_SENDER_<__child_t>>();
}
else
{
Expand Down Expand Up @@ -343,7 +343,7 @@ namespace experimental::execution
template <STDEXEC::sender _Sender>
constexpr auto operator()(_Sender &&__sndr) const -> STDEXEC::__well_formed_sender auto
{
return STDEXEC::__make_sexpr<repeat_until_t>({}, static_cast<_Sender &&>(__sndr));
return STDEXEC::__sexpr{repeat_until_t(), STDEXEC::__(), static_cast<_Sender &&>(__sndr)};
}

STDEXEC_ATTRIBUTE(always_inline)
Expand All @@ -360,7 +360,7 @@ namespace experimental::execution
template <STDEXEC::sender _Sender>
constexpr auto operator()(_Sender &&__sndr) const -> STDEXEC::__well_formed_sender auto
{
return STDEXEC::__make_sexpr<repeat_t>({}, static_cast<_Sender &&>(__sndr));
return STDEXEC::__sexpr{repeat_t(), STDEXEC::__(), static_cast<_Sender &&>(__sndr)};
}

STDEXEC_ATTRIBUTE(always_inline)
Expand All @@ -386,7 +386,7 @@ namespace experimental::execution
{
return __not_a_sender<_WHAT_(_INVALID_ARGUMENT_, _EXPECTING_A_SENDER_OF_VOID_),
_WHERE_(_IN_ALGORITHM_, repeat_until_t),
_WITH_PRETTY_SENDER_<__child_t>,
_WITH_SENDER_<__child_t>,
_WITH_ENVIRONMENT_(_Env)>();
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/exec/sequence/ignore_all_values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ namespace experimental::execution
template <sender _Sender>
auto operator()(_Sender&& __sndr) const
{
return __make_sexpr<ignore_all_values_t>(__(), static_cast<_Sender&&>(__sndr));
return __sexpr{ignore_all_values_t(), __(), static_cast<_Sender&&>(__sndr)};
}

STDEXEC_ATTRIBUTE(always_inline)
Expand Down
6 changes: 3 additions & 3 deletions include/exec/sequence/merge_each.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,12 +812,12 @@ namespace experimental::execution
template <class... _Args>
using __f = std::conditional_t<
sizeof...(_Env) == 0 && sizeof...(_Args) == 1 && (dependent_sender<_Args> && ...),
STDEXEC::__mexception<dependent_sender_error, _WITH_PRETTY_SENDER_<_Args>...>,
STDEXEC::__mexception<dependent_sender_error, _WITH_SENDER_<_Args>...>,
STDEXEC::__mexception<_WHAT_(_INVALID_ARGUMENT_),
_WHERE_(_IN_ALGORITHM_, merge_each_t),
_WHY_(_MERGE_WITH_REQUIRES_A_SEQUENCE_OF_SEQUENCES_),
_WITH_PRETTY_SEQUENCE_<_Sequence>,
_WITH_PRETTY_SENDER_<_Sender>,
_WITH_SEQUENCE_<_Sequence>,
_WITH_SENDER_<_Sender>,
__fn_t<_WITH_ENVIRONMENT_, _Env>...,
_WITH_ARGUMENTS_(_Args...)>>;
};
Expand Down
7 changes: 2 additions & 5 deletions include/exec/sequence/transform_each.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ namespace experimental::execution
struct _WITH_ITEM_SENDER_
{};

template <class _Sender>
using _WITH_PRETTY_ITEM_SENDER_ = _WITH_ITEM_SENDER_(STDEXEC::__demangle_t<_Sender>);

namespace __transform_each
{
using namespace STDEXEC;
Expand Down Expand Up @@ -187,10 +184,10 @@ namespace experimental::execution
if constexpr (!__callable<__closure_t, _ItemSender>)
{
return exec::__invalid_item_types<_TRANSFORM_EACH_ADAPTOR_INVOCATION_FAILED_<_Self>,
_WITH_PRETTY_SEQUENCE_<__child_of<_Self>>,
_WITH_SEQUENCE_<__child_of<_Self>>,
__fn_t<_WITH_ENVIRONMENT_, _Env>...,
_WITH_ADAPTOR_<__data_of<_Self>>,
_WITH_PRETTY_ITEM_SENDER_<_ItemSender>>();
_WITH_ITEM_SENDER_(_ItemSender)>();
}
else
{
Expand Down
Loading
Loading