diff --git a/Makefile b/Makefile index fcaa8554..f3ffc6c8 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,8 @@ ifeq (${hostSystemName},Darwin) ifeq ($(origin CXX),default) $(info CXX is using the built-in default: $(CXX)) export CXX=g++-15 - export CXXFLAGS=-stdlib=libstdc++ + CXXLIB=libstdc++ + export CXXFLAGS=-stdlib=$(CXXLIB) endif export GCOV="gcov" else ifeq (${hostSystemName},Linux) diff --git a/bin/mk-module.py b/bin/mk-module.py index ddad4234..c0c44feb 100755 --- a/bin/mk-module.py +++ b/bin/mk-module.py @@ -167,6 +167,7 @@ def get_dependencies(component): def write_header(to, header): filename = f"include/{header}.hpp" + print(f"writing {filename}...") with open(filename) as file: number = 0 for line in file.readlines(): diff --git a/bin/run-docker b/bin/run-docker new file mode 100644 index 00000000..88ddd5c8 --- /dev/null +++ b/bin/run-docker @@ -0,0 +1 @@ +docker run -it --rm -v $PWD:$PWD -u $(id -u):$(id -g) ghcr.io/bemanproject/infra-containers-gcc:15 bash diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c7388882..fad47f12 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -35,7 +35,8 @@ set(EXAMPLES ) if(BEMAN_USE_MODULES) - list(APPEND EXAMPLES modules modules-and-header) + #-dk:TODO gcc doesn't like the modules: list(APPEND EXAMPLES modules modules-and-header) + list(APPEND EXAMPLES modules-and-header) endif() foreach(EXAMPLE ${EXAMPLES}) @@ -43,6 +44,7 @@ foreach(EXAMPLE ${EXAMPLES}) add_executable(${EXAMPLE_TARGET}) target_sources(${EXAMPLE_TARGET} PRIVATE ${EXAMPLE}.cpp) if(BEMAN_USE_MODULES) + target_compile_definitions(${EXAMPLE_TARGET} PUBLIC BEMAN_HAS_MODULES) target_link_libraries(${EXAMPLE_TARGET} PRIVATE beman::execution) else() target_link_libraries( diff --git a/examples/intro-5-consumer.cpp b/examples/intro-5-consumer.cpp index 126e3a27..0d300a53 100644 --- a/examples/intro-5-consumer.cpp +++ b/examples/intro-5-consumer.cpp @@ -11,6 +11,7 @@ #include #ifdef BEMAN_HAS_MODULES import beman.execution; +import beman.execution.detail; #else #include #endif diff --git a/examples/just_stopped.cpp b/examples/just_stopped.cpp index fe0baee0..fe9d5593 100644 --- a/examples/just_stopped.cpp +++ b/examples/just_stopped.cpp @@ -1,7 +1,11 @@ // examples/just_stopped.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else #include +#endif namespace ex = beman::execution; struct receiver { diff --git a/examples/modules.cpp b/examples/modules.cpp index ea400d62..d1ffb843 100644 --- a/examples/modules.cpp +++ b/examples/modules.cpp @@ -14,11 +14,7 @@ import std; #endif -#ifdef BEMAN_HAS_MODULES import beman.execution; -#else -#include -#endif namespace ex = beman::execution; diff --git a/examples/sender-demo.cpp b/examples/sender-demo.cpp index 6f4c1aa3..aa31f9f1 100644 --- a/examples/sender-demo.cpp +++ b/examples/sender-demo.cpp @@ -9,6 +9,7 @@ #include #ifdef BEMAN_HAS_MODULES import beman.execution; +import beman.execution.detail; #else #include #endif diff --git a/include/beman/execution/detail/affine_on.hpp b/include/beman/execution/detail/affine_on.hpp index d86d0164..789df20a 100644 --- a/include/beman/execution/detail/affine_on.hpp +++ b/include/beman/execution/detail/affine_on.hpp @@ -5,6 +5,41 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_AFFINE_ON #include +#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.completion_signatures; +import beman.execution.detail.env; +import beman.execution.detail.forward_like; +import beman.execution.detail.fwd_env; +import beman.execution.detail.get_completion_signatures; +import beman.execution.detail.get_domain_early; +import beman.execution.detail.get_scheduler; +import beman.execution.detail.get_stop_token; +import beman.execution.detail.join_env; +import beman.execution.detail.make_sender; +import beman.execution.detail.never_stop_token; +import beman.execution.detail.nested_sender_has_affine_on; +import beman.execution.detail.prop; +import beman.execution.detail.schedule; +import beman.execution.detail.schedule_from; +import beman.execution.detail.scheduler; +import beman.execution.detail.sender; +import beman.execution.detail.sender_adaptor; +import beman.execution.detail.sender_adaptor_closure; +import beman.execution.detail.sender_for; +import beman.execution.detail.sender_has_affine_on; +import beman.execution.detail.set_value; +import beman.execution.detail.tag_of_t; +import beman.execution.detail.transform_sender; +import beman.execution.detail.write_env; +#else #include #include #include @@ -25,11 +60,7 @@ #include #include #include - -#include -#include - -#include +#endif // ---------------------------------------------------------------------------- @@ -66,7 +97,7 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { */ template <::beman::execution::sender Sender> auto operator()(Sender&& sender) const { - return ::beman::execution::detail::transform_sender( + return ::beman::execution::transform_sender( ::beman::execution::detail::get_domain_early(sender), ::beman::execution::detail::make_sender( *this, ::beman::execution::env<>{}, ::std::forward(sender))); @@ -111,7 +142,8 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { } -> ::std::same_as<::beman::execution::completion_signatures<::beman::execution::set_value_t()>>; } static auto transform_sender(Sender&& sender, const Env& ev) { - [[maybe_unused]] auto& [tag, data, child] = sender; + //[[maybe_unused]] auto& [tag, data, child] = sender; + auto& child = sender.template get<2>(); using child_tag_t = ::beman::execution::tag_of_t<::std::remove_cvref_t>; if constexpr (::beman::execution::detail::nested_sender_has_affine_on) { diff --git a/include/beman/execution/detail/allocator_aware_move.hpp b/include/beman/execution/detail/allocator_aware_move.hpp index 4b4db2ad..de12ef6f 100644 --- a/include/beman/execution/detail/allocator_aware_move.hpp +++ b/include/beman/execution/detail/allocator_aware_move.hpp @@ -5,12 +5,22 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ALLOCATOR_AWARE_MOVE #include -#include -#include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.get_allocator; +import beman.execution.detail.get_env; +import beman.execution.detail.product_type; +#else +#include +#include +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/almost_scheduler.hpp b/include/beman/execution/detail/almost_scheduler.hpp index bc418175..6c306f31 100644 --- a/include/beman/execution/detail/almost_scheduler.hpp +++ b/include/beman/execution/detail/almost_scheduler.hpp @@ -5,12 +5,23 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ALMOST_SCHEDULER #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.queryable; +import beman.execution.detail.schedule; +import beman.execution.detail.scheduler_t; +import beman.execution.detail.sender; +#else #include #include #include #include -#include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/apply_sender.hpp b/include/beman/execution/detail/apply_sender.hpp index 2c079a5e..da671f29 100644 --- a/include/beman/execution/detail/apply_sender.hpp +++ b/include/beman/execution/detail/apply_sender.hpp @@ -5,9 +5,18 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_APPLY_SENDER #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.default_domain; +import beman.execution.detail.sender; +#else #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/as_awaitable.hpp b/include/beman/execution/detail/as_awaitable.hpp index 68fa058a..0d96038e 100644 --- a/include/beman/execution/detail/as_awaitable.hpp +++ b/include/beman/execution/detail/as_awaitable.hpp @@ -5,14 +5,24 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_AS_AWAITABLE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.awaitable_sender; +import beman.execution.detail.is_awaitable; +import beman.execution.detail.sender_awaitable; +import beman.execution.detail.unspecified_promise; +#else #include #include #include #include - -#include -#include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/as_except_ptr.hpp b/include/beman/execution/detail/as_except_ptr.hpp index c14d5633..e54b3359 100644 --- a/include/beman/execution/detail/as_except_ptr.hpp +++ b/include/beman/execution/detail/as_except_ptr.hpp @@ -5,12 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_AS_EXCEPT_PTR #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include #include #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/as_tuple.hpp b/include/beman/execution/detail/as_tuple.hpp index b00c530c..625261d6 100644 --- a/include/beman/execution/detail/as_tuple.hpp +++ b/include/beman/execution/detail/as_tuple.hpp @@ -5,7 +5,11 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_AS_TUPLE #include +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.decayed_tuple; +#else #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/associate.hpp b/include/beman/execution/detail/associate.hpp index 0eea2a34..6ae90a1d 100644 --- a/include/beman/execution/detail/associate.hpp +++ b/include/beman/execution/detail/associate.hpp @@ -5,18 +5,47 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ASSOCIATE #include -#include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_sender; +import beman.execution.detail.connect; +import beman.execution.detail.connect_result_t; +import beman.execution.detail.completion_signatures; +import beman.execution.detail.completion_signatures_for; +import beman.execution.detail.default_impls; +import beman.execution.detail.env; +import beman.execution.detail.forward_like; +import beman.execution.detail.get_domain_early; +import beman.execution.detail.impls_for; +import beman.execution.detail.make_sender; +import beman.execution.detail.nothrow_callable; +import beman.execution.detail.scope_token; +import beman.execution.detail.sender; +import beman.execution.detail.sender_adaptor; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +import beman.execution.detail.start; +import beman.execution.detail.transform_sender; +import beman.execution.detail.valid_completion_signatures; +#else #include -#include -#include -#include -#include #include +#include #include +#include +#include +#include +#include #include -#include -#include +#include +#endif // ---------------------------------------------------------------------------- @@ -72,6 +101,7 @@ struct associate_data { wrap_sender sender; }; }; + template <::beman::execution::scope_token Token, ::beman::execution::sender Sender> associate_data(Token, Sender&&) -> associate_data; @@ -90,94 +120,96 @@ struct associate_t { auto operator()(Token token) const { return ::beman::execution::detail::sender_adaptor{*this, ::std::move(token)}; } -}; -template <> -struct impls_for : ::beman::execution::detail::default_impls { - template - struct get_wrap_sender; - - template - struct get_wrap_sender<::beman::execution::detail::basic_sender> { - using type = typename ::std::remove_cvref_t::wrap_sender; - }; + public: + template + static consteval auto get_completion_signatures() { + using Data = decltype(std::declval<::std::remove_cvref_t>().template get<1>()); + using child_type_t = ::std::remove_cvref_t::wrap_sender>; + return ::beman::execution::detail::completion_signatures_for{}; + } - template - struct op_state { - using assoc_t = typename AssociateData::assoc_t; - using sender_ref_t = typename AssociateData::sender_ref; - using op_t = ::beman::execution::connect_result_t; + struct impls_for : ::beman::execution::detail::default_impls { + template + struct get_wrap_sender; - assoc_t assoc; - union { - Receiver* rcvr; - op_t op; + template + struct get_wrap_sender<::beman::execution::detail::basic_sender> { + using type = typename ::std::remove_cvref_t::wrap_sender; }; - explicit op_state(::std::pair parts, Receiver& r) : assoc(::std::move(parts.first)) { - if (assoc) { - ::std::construct_at(::std::addressof(op), - ::beman::execution::connect(::std::move(*parts.second), ::std::move(r))); - } else { - rcvr = ::std::addressof(r); + template + struct op_state { + using assoc_t = typename AssociateData::assoc_t; + using sender_ref_t = typename AssociateData::sender_ref; + using op_t = ::beman::execution::connect_result_t; + + assoc_t assoc; + union { + Receiver* rcvr; + op_t op; + }; + + explicit op_state(::std::pair parts, Receiver& r) + : assoc(::std::move(parts.first)) { + if (assoc) { + ::std::construct_at(::std::addressof(op), + ::beman::execution::connect(::std::move(*parts.second), ::std::move(r))); + } else { + rcvr = ::std::addressof(r); + } } - } - explicit op_state(AssociateData&& ad, Receiver& r) : op_state(::std::move(ad).release(), r) {} + explicit op_state(AssociateData&& ad, Receiver& r) : op_state(::std::move(ad).release(), r) {} - explicit op_state(const AssociateData& ad, Receiver& r) - requires ::std::copy_constructible - : op_state(AssociateData(ad).release(), r) {} + explicit op_state(const AssociateData& ad, Receiver& r) + requires ::std::copy_constructible + : op_state(AssociateData(ad).release(), r) {} - op_state(const op_state&) = delete; + op_state(const op_state&) = delete; - op_state(op_state&&) = delete; + op_state(op_state&&) = delete; - ~op_state() { - if (this->assoc) { - op.~op_t(); + ~op_state() { + if (this->assoc) { + op.~op_t(); + } } - } - auto operator=(const op_state&) -> op_state& = delete; + auto operator=(const op_state&) -> op_state& = delete; - auto operator=(op_state&&) -> op_state& = delete; + auto operator=(op_state&&) -> op_state& = delete; - auto run() noexcept -> void { - if (this->assoc) { - ::beman::execution::start(this->op); - } else { - ::beman::execution::set_stopped(::std::move(*this->rcvr)); + auto run() noexcept -> void { + if (this->assoc) { + ::beman::execution::start(this->op); + } else { + ::beman::execution::set_stopped(::std::move(*this->rcvr)); + } } - } - }; + }; - struct get_state_impl { - template - auto operator()(Sender&& sender, Receiver& receiver) const - noexcept((::std::same_as> || - ::std::is_nothrow_constructible_v<::std::remove_cvref_t, Sender>) && - execution::detail::nothrow_callable<::beman::execution::connect_t, - typename get_wrap_sender<::std::remove_cvref_t>::type, - Receiver>) { - auto [_, data] = ::std::forward(sender); - return op_state{::beman::execution::detail::forward_like(data), receiver}; - } - }; - static constexpr auto get_state{get_state_impl{}}; - struct start_impl { - auto operator()(auto& state, auto&&) const noexcept -> void { state.run(); } + struct get_state_impl { + template + auto operator()(Sender&& sender, Receiver& receiver) const noexcept( + (::std::same_as> || + ::std::is_nothrow_constructible_v<::std::remove_cvref_t, Sender>) && + execution::detail::nothrow_callable<::beman::execution::connect_t, + typename get_wrap_sender<::std::remove_cvref_t>::type, + Receiver>) { + return op_state{ + ::beman::execution::detail::forward_like(::std::forward(sender).template get<1>()), + receiver}; + } + }; + static constexpr auto get_state{get_state_impl{}}; + struct start_impl { + auto operator()(auto& state, auto&&) const noexcept -> void { state.run(); } + }; + static constexpr auto start{start_impl{}}; }; - static constexpr auto start{start_impl{}}; }; -template -struct completion_signatures_for_impl< - ::beman::execution::detail::basic_sender<::beman::execution::detail::associate_t, Data>, - Env> { - using child_type_t = typename ::std::remove_cvref_t::wrap_sender; - using type = ::beman::execution::detail::completion_signatures_for; -}; } // namespace beman::execution::detail namespace beman::execution { diff --git a/include/beman/execution/detail/atomic_intrusive_stack.hpp b/include/beman/execution/detail/atomic_intrusive_stack.hpp index 38cf748e..1113e7ef 100644 --- a/include/beman/execution/detail/atomic_intrusive_stack.hpp +++ b/include/beman/execution/detail/atomic_intrusive_stack.hpp @@ -5,11 +5,18 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ATOMIC_INTRUSIVE_STACK #include -#include - +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.intrusive_stack; +#else +#include +#endif namespace beman::execution::detail { diff --git a/include/beman/execution/detail/await_result_type.hpp b/include/beman/execution/detail/await_result_type.hpp index c5d959c3..6897a9e5 100644 --- a/include/beman/execution/detail/await_result_type.hpp +++ b/include/beman/execution/detail/await_result_type.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_AWAIT_RESULT_TYPE #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.get_awaiter; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/await_suspend_result.hpp b/include/beman/execution/detail/await_suspend_result.hpp index 2c21427b..210c8ecc 100644 --- a/include/beman/execution/detail/await_suspend_result.hpp +++ b/include/beman/execution/detail/await_suspend_result.hpp @@ -5,9 +5,13 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_AWAIT_SUSPEND_RESULT #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/awaitable_sender.hpp b/include/beman/execution/detail/awaitable_sender.hpp index 069dd06e..6380c950 100644 --- a/include/beman/execution/detail/awaitable_sender.hpp +++ b/include/beman/execution/detail/awaitable_sender.hpp @@ -5,11 +5,19 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_AWAITABLE_SENDER #include -#include -#include - +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.env_of_t; +import beman.execution.detail.single_sender; +#else +#include +#include +#endif namespace beman::execution::detail { template diff --git a/include/beman/execution/detail/basic_operation.hpp b/include/beman/execution/detail/basic_operation.hpp index 8ba4fdb1..de6cf11d 100644 --- a/include/beman/execution/detail/basic_operation.hpp +++ b/include/beman/execution/detail/basic_operation.hpp @@ -5,17 +5,35 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_OPERATION #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_state; +import beman.execution.detail.connect_all; +import beman.execution.detail.connect_all_result; +import beman.execution.detail.impls_for; +import beman.execution.detail.indices_for; +import beman.execution.detail.operation_state; +import beman.execution.detail.sender_decompose; +import beman.execution.detail.start; +import beman.execution.detail.state_type; +import beman.execution.detail.tag_of_t; +import beman.execution.detail.valid_specialization; +#else #include -#include +#include +#include +#include #include +#include +#include #include -#include -#include #include -#include -#include -#include +#endif // ---------------------------------------------------------------------------- @@ -56,7 +74,7 @@ struct basic_operation : ::beman::execution::detail::basic_state void { ::std::invoke( [this]<::std::size_t... I>(::std::index_sequence) { - ::beman::execution::detail::impls_for::start( + ::beman::execution::detail::get_impls_for::start()( this->state, this->receiver, this->inner_ops.template get()...); }, ::std::make_index_sequence{}); diff --git a/include/beman/execution/detail/basic_receiver.hpp b/include/beman/execution/detail/basic_receiver.hpp index 1a3cd47b..da85dce8 100644 --- a/include/beman/execution/detail/basic_receiver.hpp +++ b/include/beman/execution/detail/basic_receiver.hpp @@ -5,20 +5,40 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_RECEIVER #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_state; +import beman.execution.detail.callable; +import beman.execution.detail.env_type; +import beman.execution.detail.get_env; +import beman.execution.detail.impls_for; +import beman.execution.detail.receiver; +import beman.execution.detail.sender_decompose; +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +import beman.execution.detail.state_type; +import beman.execution.detail.tag_of_t; +import beman.execution.detail.valid_specialization; +#else #include #include #include +#include #include #include #include -#include -#include -#include -#include #include #include #include -#include +#include +#include +#include +#endif // ---------------------------------------------------------------------------- @@ -40,7 +60,7 @@ template using receiver_concept = ::beman::execution::receiver_t; using tag_t = ::beman::execution::tag_of_t; using state_t = ::beman::execution::detail::state_type; - static constexpr const auto& complete = ::beman::execution::detail::impls_for::complete; + static constexpr const auto& complete = ::beman::execution::detail::get_impls_for::complete(); ::beman::execution::detail::basic_state* op{}; private: @@ -76,7 +96,8 @@ template } auto get_env() const noexcept -> ::beman::execution::detail::env_type { - return ::beman::execution::detail::impls_for::get_env(Index(), this->op->state, this->op->receiver); + return ::beman::execution::detail::get_impls_for::get_env()( + Index(), this->op->state, this->op->receiver); } }; } // namespace beman::execution::detail diff --git a/include/beman/execution/detail/basic_sender.hpp b/include/beman/execution/detail/basic_sender.hpp index 62bba28a..485b4074 100644 --- a/include/beman/execution/detail/basic_sender.hpp +++ b/include/beman/execution/detail/basic_sender.hpp @@ -5,22 +5,57 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_SENDER #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_operation; +import beman.execution.detail.completion_signatures_for; +import beman.execution.detail.connect; +import beman.execution.detail.connect_all; +import beman.execution.detail.decays_to; +import beman.execution.detail.get_completion_signatures; +import beman.execution.detail.impls_for; +import beman.execution.detail.product_type; +import beman.execution.detail.receiver; +import beman.execution.detail.sender; +import beman.execution.detail.sender_decompose; +#else #include #include +#include #include +#include #include #include #include #include -#include -#include -#include +#endif #include // ---------------------------------------------------------------------------- namespace beman::execution::detail { +template <::std::size_t Start, typename Fun, typename Tuple, ::std::size_t... I> +constexpr auto sub_apply_helper(Fun&& fun, Tuple&& tuple, ::std::index_sequence) -> decltype(auto) { + // NOLINTNEXTLINE(bugprone-use-after-move,hicpp-invalid-access-moved) + return ::std::forward(fun)(::std::forward(tuple).template get()...); +} +struct sub_apply_t { + template <::std::size_t Start, typename Fun, typename Tuple> + constexpr auto at(Fun&& fun, Tuple&& tuple) const -> decltype(auto) { + constexpr ::std::size_t TSize{::std::remove_cvref_t::size()}; + static_assert(Start <= TSize); + return sub_apply_helper( + ::std::forward(fun), ::std::forward(tuple), ::std::make_index_sequence()); + } +}; +inline constexpr sub_apply_t sub_apply{}; + /*! * \brief Class template used to factor out common sender implementation for library senders. * \headerfile beman/execution/execution.hpp @@ -32,10 +67,11 @@ struct basic_sender : ::beman::execution::detail::product_type; + static constexpr ::std::integral_constant<::std::size_t, sizeof...(Child) + 2> size{}; auto get_env() const noexcept -> decltype(auto) { auto&& d{this->template get<1>()}; - return sub_apply<2>( + return sub_apply.at<2>( [&d](auto&&... c) { return ::beman::execution::detail::impls_for::get_attrs(d, c...); }, *this); } @@ -74,37 +110,30 @@ struct basic_sender : ::beman::execution::detail::product_type(self), ::std::move(receiver)}; } #endif -#if __cpp_explicit_this_parameter < 302110L - template - auto - get_completion_signatures(Env&&) && -> ::beman::execution::detail::completion_signatures_for { - return {}; - } - template - auto get_completion_signatures( - Env&&) const&& -> ::beman::execution::detail::completion_signatures_for { - return {}; - } - template - auto - get_completion_signatures(Env&&) & -> ::beman::execution::detail::completion_signatures_for { - return {}; - } - template - auto get_completion_signatures( - Env&&) const& -> ::beman::execution::detail::completion_signatures_for { - return {}; - } -#else - template <::beman::execution::detail::decays_to Self, typename Env> - auto get_completion_signatures(this Self&&, Env&&) noexcept - -> ::beman::execution::detail::completion_signatures_for { - return {}; + template <::beman::execution::detail::decays_to Self, typename... Env> + consteval auto get_completion_signatures(this Self&&, Env&&...) noexcept { + if constexpr (requires { Tag::template get_completion_signatures(); }) + return Tag::template get_completion_signatures(); + else + return ::beman::execution::detail::completion_signatures_for{}; } -#endif }; } // namespace beman::execution::detail +#ifndef BEMAN_HAS_MODULES +namespace std { +template +struct tuple_size<::beman::execution::detail::basic_sender> + : ::std::integral_constant {}; + +template <::std::size_t I, typename... T> +struct tuple_element> { + using type = + ::std::decay_t>().template get())>; +}; +} // namespace std +#endif + // ---------------------------------------------------------------------------- #include diff --git a/include/beman/execution/detail/basic_state.hpp b/include/beman/execution/detail/basic_state.hpp index 128fb7a6..3314e725 100644 --- a/include/beman/execution/detail/basic_state.hpp +++ b/include/beman/execution/detail/basic_state.hpp @@ -5,12 +5,23 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_STATE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.impls_for; +import beman.execution.detail.sender_decompose; +import beman.execution.detail.state_type; +import beman.execution.detail.tag_of_t; +#else #include #include -#include #include -#include -#include +#include +#endif // ---------------------------------------------------------------------------- @@ -20,13 +31,13 @@ namespace beman::execution::detail { * \headerfile beman/execution/execution.hpp * \internal */ -//-dk:TODO the export below shouldn't be needed, but MSVC++ seems to require it (2026-02-01) -template //-dk:TODO detail export +template struct basic_state { + using tag_t = ::beman::execution::tag_of_t; basic_state(Sender&& sender, Receiver&& rcvr) noexcept(true) : receiver(::std::move(rcvr)), - state(::beman::execution::detail::impls_for<::beman::execution::tag_of_t>::get_state( - ::std::forward(sender), this->receiver)) {} + state(::beman::execution::detail::get_impls_for::get_state()(::std::forward(sender), + this->receiver)) {} Receiver receiver; ::beman::execution::detail::state_type state; diff --git a/include/beman/execution/detail/bulk.hpp b/include/beman/execution/detail/bulk.hpp index cdcc896d..a7b37922 100644 --- a/include/beman/execution/detail/bulk.hpp +++ b/include/beman/execution/detail/bulk.hpp @@ -5,33 +5,80 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_BULK #include -#include -#include -#include -#include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_sender; +import beman.execution.detail.completion_signatures; +import beman.execution.detail.completion_signatures_for; +import beman.execution.detail.default_impls; +import beman.execution.detail.get_completion_signatures; +import beman.execution.detail.get_domain_early; +import beman.execution.detail.impls_for; +import beman.execution.detail.make_sender; +import beman.execution.detail.meta.combine; +import beman.execution.detail.meta.unique; +import beman.execution.detail.movable_value; +import beman.execution.detail.product_type; +import beman.execution.detail.sender; +import beman.execution.detail.sender_adaptor; +import beman.execution.detail.sender_adaptor_closure; +import beman.execution.detail.set_error; +import beman.execution.detail.set_value; +import beman.execution.detail.transform_sender; +#else #include #include #include +#include +#include #include +#include #include +#include +#include #include #include #include +#include +#include #include -#include -#include -#include #include -#include -#include -#include -#include -#include +#include +#endif -#include namespace beman::execution::detail { +template +struct fixed_completions_helper; + +template +struct fixed_completions_helper> { + + template + struct may_throw; + template + struct may_throw { + static constexpr bool value = + std::same_as && !::std::is_nothrow_invocable(); + }; + template + struct may_throw> { + static constexpr bool value = (false || ... || may_throw::value); + }; + + using type = std::conditional_t::value, + completion_signatures, + completion_signatures>; +}; + struct bulk_t : ::beman::execution::sender_adaptor_closure { template @@ -52,82 +99,65 @@ struct bulk_t : ::beman::execution::sender_adaptor_closure { ::beman::execution::detail::make_sender( *this, ::beman::execution::detail::product_type{shape, fun}, std::forward(sndr))); } -}; - -template <> -struct impls_for : ::beman::execution::detail::default_impls { - - struct complete_impl { - template - requires(!::std::same_as || std::is_invocable_v) - auto operator()(Index, - ::beman::execution::detail::product_type& state, - Rcvr& rcvr, - Tag, - Args&&... args) const noexcept -> void { - if constexpr (std::same_as) { - auto& [shape, f] = state; - - using s_type = std::remove_cvref_t; - constexpr bool nothrow = noexcept(f(s_type(shape), args...)); + private: + template + using fixed_completions = typename fixed_completions_helper::type; + template + struct get_signatures; + template + struct get_signatures<::beman::execution::detail::basic_sender<::beman::execution::detail::bulk_t, + ::beman::execution::detail::product_type, + Sender>, + Env> { + using completions = + decltype(::beman::execution::get_completion_signatures(std::declval(), std::declval())); + using type = ::beman::execution::detail::meta::unique< + ::beman::execution::detail::meta::combine>>; + }; - try { - [&]() noexcept(nothrow) { - for (decltype(s_type(shape)) i = 0; i < shape; i++) { - f(s_type(i), args...); + public: + template + static consteval auto get_completion_signatures() { + return typename get_signatures, Env...>::type{}; + } + struct impls_for : ::beman::execution::detail::default_impls { + + struct complete_impl { + template + requires(!::std::same_as || std::is_invocable_v) + auto operator()(Index, + ::beman::execution::detail::product_type& state, + Rcvr& rcvr, + Tag, + Args&&... args) const noexcept -> void { + if constexpr (std::same_as) { + auto& [shape, f] = state; + + using s_type = std::remove_cvref_t; + + constexpr bool nothrow = noexcept(f(s_type(shape), args...)); + + try { + [&]() noexcept(nothrow) { + for (decltype(s_type(shape)) i = 0; i < shape; i++) { + f(s_type(i), args...); + } + Tag()(std::move(rcvr), std::forward(args)...); + }(); + + } catch (...) { + if constexpr (not nothrow) { + ::beman::execution::set_error(std::move(rcvr), std::current_exception()); } - Tag()(std::move(rcvr), std::forward(args)...); - }(); - - } catch (...) { - if constexpr (not nothrow) { - ::beman::execution::set_error(std::move(rcvr), std::current_exception()); } + } else { + Tag()(std::move(rcvr), std::forward(args)...); } - } else { - Tag()(std::move(rcvr), std::forward(args)...); } - } - }; - static constexpr auto complete{complete_impl{}}; -}; - -template -struct fixed_completions_helper; - -template -struct fixed_completions_helper> { - - template - struct may_throw; - template - struct may_throw { - static constexpr bool value = - std::same_as && !::std::is_nothrow_invocable(); + }; + static constexpr auto complete{complete_impl{}}; }; - template - struct may_throw> { - static constexpr bool value = (false || ... || may_throw::value); - }; - - using type = std::conditional_t::value, - completion_signatures, - completion_signatures>; -}; - -template -using fixed_completions = typename fixed_completions_helper::type; - -template -struct completion_signatures_for_impl< - ::beman::execution::detail:: - basic_sender<::beman::execution::detail::bulk_t, ::beman::execution::detail::product_type, Sender>, - Env> { - - using completions = decltype(get_completion_signatures(std::declval(), std::declval())); - using type = ::beman::execution::detail::meta::unique< - ::beman::execution::detail::meta::combine>>; }; } // namespace beman::execution::detail diff --git a/include/beman/execution/detail/call_result_t.hpp b/include/beman/execution/detail/call_result_t.hpp index ab681798..19aaa2a6 100644 --- a/include/beman/execution/detail/call_result_t.hpp +++ b/include/beman/execution/detail/call_result_t.hpp @@ -5,7 +5,11 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CALL_RESULT #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/callable.hpp b/include/beman/execution/detail/callable.hpp index f6a9122f..3483fb02 100644 --- a/include/beman/execution/detail/callable.hpp +++ b/include/beman/execution/detail/callable.hpp @@ -5,7 +5,11 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CALLABLE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/child_type.hpp b/include/beman/execution/detail/child_type.hpp index 63fd1c71..4843bc67 100644 --- a/include/beman/execution/detail/child_type.hpp +++ b/include/beman/execution/detail/child_type.hpp @@ -5,8 +5,12 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CHILD_TYPE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/class_type.hpp b/include/beman/execution/detail/class_type.hpp index c92cf5d2..5de3c940 100644 --- a/include/beman/execution/detail/class_type.hpp +++ b/include/beman/execution/detail/class_type.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CLASS_TYPE #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.decays_to; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/common.hpp b/include/beman/execution/detail/common.hpp index 055ba2b9..94db69b5 100644 --- a/include/beman/execution/detail/common.hpp +++ b/include/beman/execution/detail/common.hpp @@ -11,6 +11,11 @@ #else #define BEMAN_EXECUTION_DELETE(msg) delete #endif +#if defined(__GNUC__) && !defined(__clang__) +#define BEMAN_SPECIALIZE_EXPORT +#else +#define BEMAN_SPECIALIZE_EXPORT template <> +#endif // ---------------------------------------------------------------------------- /*! diff --git a/include/beman/execution/detail/completion_domain.hpp b/include/beman/execution/detail/completion_domain.hpp index ebc87003..fa643c3d 100644 --- a/include/beman/execution/detail/completion_domain.hpp +++ b/include/beman/execution/detail/completion_domain.hpp @@ -5,12 +5,27 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_DOMAIN #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.default_domain; +import beman.execution.detail.get_completion_scheduler; +import beman.execution.detail.get_domain; +import beman.execution.detail.get_env; +import beman.execution.detail.sender; +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +#else #include -#include #include +#include #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/completion_signature.hpp b/include/beman/execution/detail/completion_signature.hpp index 11b06b7b..b4036b8d 100644 --- a/include/beman/execution/detail/completion_signature.hpp +++ b/include/beman/execution/detail/completion_signature.hpp @@ -5,10 +5,20 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +#else #include #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/completion_signatures.hpp b/include/beman/execution/detail/completion_signatures.hpp index 0da03b1d..20c2f0be 100644 --- a/include/beman/execution/detail/completion_signatures.hpp +++ b/include/beman/execution/detail/completion_signatures.hpp @@ -5,9 +5,17 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.completion_signature; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/completion_signatures_for.hpp b/include/beman/execution/detail/completion_signatures_for.hpp index b0b09530..94a1550c 100644 --- a/include/beman/execution/detail/completion_signatures_for.hpp +++ b/include/beman/execution/detail/completion_signatures_for.hpp @@ -5,11 +5,21 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES_FOR #include -#include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include #include #include -#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.get_completion_signatures; +import beman.execution.detail.sender_in; +import beman.execution.detail.tag_of_t; +#else +#include +#include +#endif // ---------------------------------------------------------------------------- @@ -26,22 +36,23 @@ struct no_completion_signatures_defined_in_sender {}; * \headerfile beman/execution/execution.hpp * \internal */ -template -struct completion_signatures_for_impl { - using type = ::beman::execution::detail::no_completion_signatures_defined_in_sender; -}; + +template +consteval auto get_completion_signatures_for_helper() { + using tag_t = ::std::remove_cvref_t<::beman::execution::tag_of_t<::std::remove_cvref_t>>; + if constexpr (requires { tag_t::template get_completion_signatures(); }) + return tag_t::template get_completion_signatures(); + else + return ::beman::execution::detail::no_completion_signatures_defined_in_sender{}; +} /*! * \brief Type alias used to access a senders completion signatures. * \headerfile beman/execution/execution.hpp * \internal */ -template -using completion_signatures_for = ::std::conditional_t< - ::std::same_as::type>, - typename ::beman::execution::detail::completion_signatures_for_impl<::std::remove_cvref_t, Env>::type, - typename ::beman::execution::detail::completion_signatures_for_impl::type>; +template +using completion_signatures_for = decltype(get_completion_signatures_for_helper()); } // namespace beman::execution::detail // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/completion_signatures_of_t.hpp b/include/beman/execution/detail/completion_signatures_of_t.hpp index 2336713c..61b57e23 100644 --- a/include/beman/execution/detail/completion_signatures_of_t.hpp +++ b/include/beman/execution/detail/completion_signatures_of_t.hpp @@ -5,10 +5,17 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES_OF #include +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.call_result_t; +import beman.execution.detail.env; +import beman.execution.detail.get_completion_signatures; +import beman.execution.detail.sender_in; +#else #include #include #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/completion_tag.hpp b/include/beman/execution/detail/completion_tag.hpp index 6376724b..9d1fb782 100644 --- a/include/beman/execution/detail/completion_tag.hpp +++ b/include/beman/execution/detail/completion_tag.hpp @@ -5,10 +5,20 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_TAG #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +#else #include #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/connect.hpp b/include/beman/execution/detail/connect.hpp index d7584bd3..28de8f01 100644 --- a/include/beman/execution/detail/connect.hpp +++ b/include/beman/execution/detail/connect.hpp @@ -5,13 +5,26 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.connect_awaitable; +import beman.execution.detail.get_domain_late; +import beman.execution.detail.get_env; +import beman.execution.detail.operation_state; +import beman.execution.detail.transform_sender; +#else +#include #include #include #include -#include -#include -#include +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/connect_all.hpp b/include/beman/execution/detail/connect_all.hpp index ec2d3c6e..b4ee21fc 100644 --- a/include/beman/execution/detail/connect_all.hpp +++ b/include/beman/execution/detail/connect_all.hpp @@ -5,22 +5,43 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_ALL #include -#include -#include +#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_receiver; +import beman.execution.detail.basic_state; +import beman.execution.detail.connect; +import beman.execution.detail.connect_result_t; +import beman.execution.detail.forward_like; +import beman.execution.detail.product_type; +import beman.execution.detail.sender_decompose; +#else #include #include +#include +#include +#include #include #include -#include -#include -#include -#include +#endif // ---------------------------------------------------------------------------- -#include - namespace beman::execution::detail { +template +inline constexpr ::std::size_t get_tuple_size() { + using type = ::std::remove_cvref_t; + if constexpr (requires { type::size(); }) + return type::size(); + else + return std::tuple_size_v; +} /*! * \brief A helper types whose call operator connects all children of a basic_sender * \headerfile beman/execution/execution.hpp @@ -35,13 +56,14 @@ struct connect_all_t { return ::std::forward(fun)(seq, ::beman::execution::detail::forward_like(::std::get(tuple))...); } template - static auto apply_with_index(Fun&& fun, Tuple&& tuple) noexcept( - noexcept(apply_with_index_helper(::std::make_index_sequence<::std::tuple_size_v<::std::decay_t>>{}, - ::std::forward(fun), - ::std::forward(tuple)))) -> decltype(auto) { - return apply_with_index_helper(::std::make_index_sequence<::std::tuple_size_v<::std::decay_t>>{}, - ::std::forward(fun), - ::std::forward(tuple)); + static auto apply_with_index(Fun&& fun, Tuple&& tuple) noexcept(noexcept( + apply_with_index_helper(::std::make_index_sequence<::beman::execution::detail::get_tuple_size()>{}, + ::std::forward(fun), + ::std::forward(tuple)))) -> decltype(auto) { + return apply_with_index_helper( + ::std::make_index_sequence<::beman::execution::detail::get_tuple_size()>{}, + ::std::forward(fun), + ::std::forward(tuple)); } template <::std::size_t Start, typename Fun, typename Tuple, ::std::size_t... I> @@ -55,11 +77,11 @@ struct connect_all_t { template <::std::size_t Start, typename Fun, typename Tuple> requires requires { ::std::declval().size(); } static auto sub_apply_with_index(Fun&& fun, Tuple&& tuple) noexcept(noexcept(sub_apply_with_index_helper( - ::std::make_index_sequence<::std::tuple_size_v<::std::decay_t> - Start>{}, + ::std::make_index_sequence<::beman::execution::detail::get_tuple_size() - Start>{}, ::std::forward(fun), ::std::forward(tuple)))) -> decltype(auto) { return sub_apply_with_index_helper( - ::std::make_index_sequence<::std::tuple_size_v<::std::decay_t> - Start>{}, + ::std::make_index_sequence<::beman::execution::detail::get_tuple_size() - Start>{}, ::std::forward(fun), ::std::forward(tuple)); } diff --git a/include/beman/execution/detail/connect_all_result.hpp b/include/beman/execution/detail/connect_all_result.hpp index 0bea8680..0b66e01b 100644 --- a/include/beman/execution/detail/connect_all_result.hpp +++ b/include/beman/execution/detail/connect_all_result.hpp @@ -5,10 +5,17 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_ALL_RESULT #include +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_state; +import beman.execution.detail.call_result_t; +import beman.execution.detail.connect_all; +import beman.execution.detail.indices_for; +#else #include -#include #include +#include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/connect_awaitable.hpp b/include/beman/execution/detail/connect_awaitable.hpp index d708340d..2d7b6a3b 100644 --- a/include/beman/execution/detail/connect_awaitable.hpp +++ b/include/beman/execution/detail/connect_awaitable.hpp @@ -5,19 +5,35 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_AWAITABLE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.await_result_type; +import beman.execution.detail.completion_signatures; +import beman.execution.detail.operation_state_task; +import beman.execution.detail.receiver; +import beman.execution.detail.receiver_of; +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +import beman.execution.detail.suspend_complete; +#else #include #include #include #include #include -#include #include #include #include - -#include -#include -#include +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/connect_result_t.hpp b/include/beman/execution/detail/connect_result_t.hpp index f41e9f19..d01cb118 100644 --- a/include/beman/execution/detail/connect_result_t.hpp +++ b/include/beman/execution/detail/connect_result_t.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_RESULT #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.connect; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/continues_on.hpp b/include/beman/execution/detail/continues_on.hpp index bbeba96b..9bcb0164 100644 --- a/include/beman/execution/detail/continues_on.hpp +++ b/include/beman/execution/detail/continues_on.hpp @@ -5,25 +5,50 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONTINUES_ON #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_sender; +import beman.execution.detail.default_domain; +import beman.execution.detail.default_impls; +import beman.execution.detail.fwd_env; +import beman.execution.detail.get_domain; +import beman.execution.detail.get_domain_early; +import beman.execution.detail.get_domain_late; +import beman.execution.detail.get_env; +import beman.execution.detail.impls_for; +import beman.execution.detail.join_env; +import beman.execution.detail.make_sender; +import beman.execution.detail.query_with_default; +import beman.execution.detail.sched_attrs; +import beman.execution.detail.schedule_from; +import beman.execution.detail.scheduler; +import beman.execution.detail.sender; +import beman.execution.detail.sender_adaptor; +import beman.execution.detail.sender_for; +import beman.execution.detail.transform_sender; +#else +#include +#include #include +#include +#include #include -#include #include -#include -#include -#include +#include +#include #include - -#include +#include +#include +#include +#include +#include +#include +#include +#endif // ---------------------------------------------------------------------------- @@ -55,23 +80,16 @@ struct continues_on_t { ::beman::execution::detail::make_sender( *this, std::forward(scheduler), ::std::forward(sender))); } -}; - -/*! - * \brief Specialization of impls_for to implement the continues_on functionality - * \headerfile beman/execution/execution.hpp - * \internal - */ -template <> -struct impls_for<::beman::execution::detail::continues_on_t> : ::beman::execution::detail::default_impls { - struct get_attrs_impl { - auto operator()(const auto& data, const auto& child) const noexcept -> decltype(auto) { - return ::beman::execution::detail::join_env( - ::beman::execution::detail::sched_attrs(data), - ::beman::execution::detail::fwd_env(::beman::execution::get_env(child))); - } + struct impls_for : ::beman::execution::detail::default_impls { + struct get_attrs_impl { + auto operator()(const auto& data, const auto& child) const noexcept -> decltype(auto) { + return ::beman::execution::detail::join_env( + ::beman::execution::detail::sched_attrs(data), + ::beman::execution::detail::fwd_env(::beman::execution::get_env(child))); + } + }; + static constexpr auto get_attrs{get_attrs_impl{}}; }; - static constexpr auto get_attrs{get_attrs_impl{}}; }; /*! @@ -79,12 +97,20 @@ struct impls_for<::beman::execution::detail::continues_on_t> : ::beman::executio * \headerfile beman/execution/execution.hpp * \internal */ +#ifndef BEMAN_HAS_MODULES +#if 0 template <::beman::execution::detail::sender_for<::beman::execution::detail::continues_on_t> Sender, typename Env> auto get_domain_late(Sender&& sender, Env&&) { +#else +template +auto get_domain_late( + ::beman::execution::detail::basic_sender<::beman::execution::detail::continues_on_t, T...> const& sender, Env&&) { +#endif auto scheduler{sender.template get<1>()}; return ::beman::execution::detail::query_with_default( ::beman::execution::get_domain, scheduler, ::beman::execution::default_domain{}); } +#endif } // namespace beman::execution::detail #include diff --git a/include/beman/execution/detail/counting_scope.hpp b/include/beman/execution/detail/counting_scope.hpp index a3fae783..5b635553 100644 --- a/include/beman/execution/detail/counting_scope.hpp +++ b/include/beman/execution/detail/counting_scope.hpp @@ -5,14 +5,27 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.counting_scope_base; +import beman.execution.detail.counting_scope_join; +import beman.execution.detail.inplace_stop_source; +import beman.execution.detail.scope_token; +import beman.execution.detail.sender; +import beman.execution.detail.stop_when; +#else #include #include +#include #include #include -#include #include -#include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/counting_scope_base.hpp b/include/beman/execution/detail/counting_scope_base.hpp index 32eb394b..02062fbb 100644 --- a/include/beman/execution/detail/counting_scope_base.hpp +++ b/include/beman/execution/detail/counting_scope_base.hpp @@ -5,11 +5,19 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_BASE #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.immovable; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/counting_scope_join.hpp b/include/beman/execution/detail/counting_scope_join.hpp index 1bf15008..a4ec7245 100644 --- a/include/beman/execution/detail/counting_scope_join.hpp +++ b/include/beman/execution/detail/counting_scope_join.hpp @@ -5,6 +5,28 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_JOIN #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_sender; +import beman.execution.detail.completion_signatures; +import beman.execution.detail.completion_signatures_for; +import beman.execution.detail.connect; +import beman.execution.detail.counting_scope_base; +import beman.execution.detail.default_impls; +import beman.execution.detail.get_env; +import beman.execution.detail.get_scheduler; +import beman.execution.detail.impls_for; +import beman.execution.detail.make_sender; +import beman.execution.detail.receiver; +import beman.execution.detail.schedule; +import beman.execution.detail.set_value; +import beman.execution.detail.start; +#else #include #include #include @@ -18,8 +40,7 @@ #include #include #include - -#include +#endif // ---------------------------------------------------------------------------- @@ -31,16 +52,29 @@ struct counting_scope_join_t { auto operator()(::beman::execution::detail::counting_scope_base* ptr) const { return ::beman::execution::detail::make_sender(*this, ptr); } -}; -inline constexpr counting_scope_join_t counting_scope_join{}; -template -struct completion_signatures_for_impl< - ::beman::execution::detail::basic_sender<::beman::execution::detail::counting_scope_join_t, - ::beman::execution::detail::counting_scope_base*>, - Env> { - using type = ::beman::execution::completion_signatures<::beman::execution::set_value_t()>; + template + static consteval auto get_completion_signatures() noexcept { + return ::beman::execution::completion_signatures<::beman::execution::set_value_t()>{}; + } + struct impls_for : ::beman::execution::detail::default_impls { + struct get_state_impl { + + template + auto operator()(auto&& sender, Receiver& receiver) const noexcept(false) { + // auto [_, self] = sender; + auto self = sender.template get<1>(); + return ::beman::execution::detail::counting_scope_join_t::state(self, receiver); + } + }; + static constexpr auto get_state{get_state_impl{}}; + struct start_impl { + auto operator()(auto& s, auto&) const noexcept { s.start(); } + }; + static constexpr auto start{start_impl{}}; + }; }; +inline constexpr counting_scope_join_t counting_scope_join{}; } // namespace beman::execution::detail @@ -72,25 +106,6 @@ struct beman::execution::detail::counting_scope_join_t::state : ::beman::executi // ---------------------------------------------------------------------------- -namespace beman::execution::detail { -template <> -struct impls_for<::beman::execution::detail::counting_scope_join_t> : ::beman::execution::detail::default_impls { - struct get_state_impl { - - template - auto operator()(auto&& sender, Receiver& receiver) const noexcept(false) { - auto [_, self] = sender; - return ::beman::execution::detail::counting_scope_join_t::state(self, receiver); - } - }; - static constexpr auto get_state{get_state_impl{}}; - struct start_impl { - auto operator()(auto& s, auto&) const noexcept { s.start(); } - }; - static constexpr auto start{start_impl{}}; -}; -} // namespace beman::execution::detail - // ---------------------------------------------------------------------------- #endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_JOIN diff --git a/include/beman/execution/detail/decayed_same_as.hpp b/include/beman/execution/detail/decayed_same_as.hpp index 1ddd6336..38fa74a4 100644 --- a/include/beman/execution/detail/decayed_same_as.hpp +++ b/include/beman/execution/detail/decayed_same_as.hpp @@ -5,7 +5,11 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_SAME_AS #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/decayed_tuple.hpp b/include/beman/execution/detail/decayed_tuple.hpp index c46402cf..009a0409 100644 --- a/include/beman/execution/detail/decayed_tuple.hpp +++ b/include/beman/execution/detail/decayed_tuple.hpp @@ -5,8 +5,12 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TUPLE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/decayed_type_list.hpp b/include/beman/execution/detail/decayed_type_list.hpp index 81d720cd..2a654056 100644 --- a/include/beman/execution/detail/decayed_type_list.hpp +++ b/include/beman/execution/detail/decayed_type_list.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TYPE_LIST #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.type_list; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/decayed_typeof.hpp b/include/beman/execution/detail/decayed_typeof.hpp index f43f1f0c..91e688e5 100644 --- a/include/beman/execution/detail/decayed_typeof.hpp +++ b/include/beman/execution/detail/decayed_typeof.hpp @@ -5,7 +5,11 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TYPEOF #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/decays_to.hpp b/include/beman/execution/detail/decays_to.hpp index 5dae74b3..5aa47fb9 100644 --- a/include/beman/execution/detail/decays_to.hpp +++ b/include/beman/execution/detail/decays_to.hpp @@ -5,8 +5,12 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYS_TO #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/default_domain.hpp b/include/beman/execution/detail/default_domain.hpp index bb9c91fc..faa29f8e 100644 --- a/include/beman/execution/detail/default_domain.hpp +++ b/include/beman/execution/detail/default_domain.hpp @@ -5,12 +5,23 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_DEFAULT_DOMAIN #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.queryable; +import beman.execution.detail.sender; +import beman.execution.detail.sender_decompose; +import beman.execution.detail.tag_of_t; +#else #include #include #include #include -#include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/default_impls.hpp b/include/beman/execution/detail/default_impls.hpp index fc705570..00faf6ec 100644 --- a/include/beman/execution/detail/default_impls.hpp +++ b/include/beman/execution/detail/default_impls.hpp @@ -5,6 +5,23 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_DEFAULT_IMPLS #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.allocator_aware_move; +import beman.execution.detail.callable; +import beman.execution.detail.env; +import beman.execution.detail.forward_like; +import beman.execution.detail.fwd_env; +import beman.execution.detail.get_allocator; +import beman.execution.detail.get_env; +import beman.execution.detail.product_type; +import beman.execution.detail.sender_decompose; +import beman.execution.detail.start; +#else #include #include #include @@ -15,8 +32,7 @@ #include #include #include - -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/emplace_from.hpp b/include/beman/execution/detail/emplace_from.hpp index 8c2fa834..a2f2d492 100644 --- a/include/beman/execution/detail/emplace_from.hpp +++ b/include/beman/execution/detail/emplace_from.hpp @@ -5,10 +5,19 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_EMPLACE_FROM #include -#include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.call_result_t; +import beman.execution.detail.nothrow_callable; +#else +#include +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/env.hpp b/include/beman/execution/detail/env.hpp index 383f00b1..f1bd293f 100644 --- a/include/beman/execution/detail/env.hpp +++ b/include/beman/execution/detail/env.hpp @@ -5,9 +5,18 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ENV #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.non_assignable; +import beman.execution.detail.queryable; +#else #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/env_of_t.hpp b/include/beman/execution/detail/env_of_t.hpp index 0f3e0f8e..a69c6382 100644 --- a/include/beman/execution/detail/env_of_t.hpp +++ b/include/beman/execution/detail/env_of_t.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_OF #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.get_env; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/env_promise.hpp b/include/beman/execution/detail/env_promise.hpp index d12b23ea..58a88ab3 100644 --- a/include/beman/execution/detail/env_promise.hpp +++ b/include/beman/execution/detail/env_promise.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_PROMISE #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.with_await_transform; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/env_type.hpp b/include/beman/execution/detail/env_type.hpp index 4869e4ef..c3bddc88 100644 --- a/include/beman/execution/detail/env_type.hpp +++ b/include/beman/execution/detail/env_type.hpp @@ -5,11 +5,19 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_TYPE #include +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.call_result_t; +import beman.execution.detail.impls_for; +import beman.execution.detail.sender_decompose; +import beman.execution.detail.state_type; +import beman.execution.detail.tag_of_t; +#else #include #include #include -#include #include +#include +#endif // ---------------------------------------------------------------------------- @@ -21,7 +29,7 @@ namespace beman::execution::detail { */ template using env_type = ::beman::execution::detail::call_result_t< - decltype(::beman::execution::detail::impls_for<::beman::execution::tag_of_t>::get_env), + decltype(::beman::execution::detail::get_impls_for<::beman::execution::tag_of_t>::get_env()), Index, ::beman::execution::detail::state_type&, const Receiver&>; diff --git a/include/beman/execution/detail/error_types_of_t.hpp b/include/beman/execution/detail/error_types_of_t.hpp index aea141b9..5c594320 100644 --- a/include/beman/execution/detail/error_types_of_t.hpp +++ b/include/beman/execution/detail/error_types_of_t.hpp @@ -5,13 +5,26 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_ERROR_TYPES_OF #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.completion_signatures_of_t; +import beman.execution.detail.env; +import beman.execution.detail.gather_signatures; +import beman.execution.detail.sender_in; +import beman.execution.detail.set_error; +import beman.execution.detail.variant_or_empty; +#else #include #include #include #include #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/forward_like.hpp b/include/beman/execution/detail/forward_like.hpp index 7aa95fb3..a3a9896f 100644 --- a/include/beman/execution/detail/forward_like.hpp +++ b/include/beman/execution/detail/forward_like.hpp @@ -5,8 +5,12 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_FORWARD_LIKE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif // ---------------------------------------------------------------------------- // std::forward_like() doesn't work on some compilers, yet. This header diff --git a/include/beman/execution/detail/forwarding_query.hpp b/include/beman/execution/detail/forwarding_query.hpp index c71535b9..00084308 100644 --- a/include/beman/execution/detail/forwarding_query.hpp +++ b/include/beman/execution/detail/forwarding_query.hpp @@ -5,9 +5,13 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_FORWARDING_QUERY #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/fwd_env.hpp b/include/beman/execution/detail/fwd_env.hpp index b71d11ea..2b349b35 100644 --- a/include/beman/execution/detail/fwd_env.hpp +++ b/include/beman/execution/detail/fwd_env.hpp @@ -5,11 +5,18 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_FWD_ENV #include -#include +#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include - -#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.forwarding_query; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/gather_signatures.hpp b/include/beman/execution/detail/gather_signatures.hpp index 70b8ff45..6f14d6b4 100644 --- a/include/beman/execution/detail/gather_signatures.hpp +++ b/include/beman/execution/detail/gather_signatures.hpp @@ -5,10 +5,21 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GATHER_SIGNATURES #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.completion_signatures; +import beman.execution.detail.indirect_meta_apply; +import beman.execution.detail.meta.filter; +import beman.execution.detail.valid_completion_signatures; +#else #include +#include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_allocator.hpp b/include/beman/execution/detail/get_allocator.hpp index 0ae11ecf..e0d2c455 100644 --- a/include/beman/execution/detail/get_allocator.hpp +++ b/include/beman/execution/detail/get_allocator.hpp @@ -5,12 +5,20 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_ALLOCATOR #include -#include -#include +#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include - -#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.forwarding_query; +import beman.execution.detail.simple_allocator; +#else +#include +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_awaiter.hpp b/include/beman/execution/detail/get_awaiter.hpp index 93678dfc..664893da 100644 --- a/include/beman/execution/detail/get_awaiter.hpp +++ b/include/beman/execution/detail/get_awaiter.hpp @@ -5,7 +5,11 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_AWAITER #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_completion_scheduler.hpp b/include/beman/execution/detail/get_completion_scheduler.hpp index 725e474f..f5d95e46 100644 --- a/include/beman/execution/detail/get_completion_scheduler.hpp +++ b/include/beman/execution/detail/get_completion_scheduler.hpp @@ -5,6 +5,26 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_COMPLETION_SCHEDULER #include +#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.almost_scheduler; +import beman.execution.detail.completion_tag; +import beman.execution.detail.decayed_same_as; +import beman.execution.detail.forwarding_query; +import beman.execution.detail.get_env; +import beman.execution.detail.schedule; +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +#else +#include #include #include #include @@ -13,12 +33,7 @@ #include #include #include -#include -#include -#include -#include - -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_completion_signatures.hpp b/include/beman/execution/detail/get_completion_signatures.hpp index a172ec6e..860e8e33 100644 --- a/include/beman/execution/detail/get_completion_signatures.hpp +++ b/include/beman/execution/detail/get_completion_signatures.hpp @@ -5,17 +5,32 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_COMPLETION_SIGNATURES #include -#include -#include -#include -#include //-dk:TODO remove -#include -#include //-dk:TODO remove - +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.await_result_type; +import beman.execution.detail.completion_signatures; +import beman.execution.detail.env_promise; +import beman.execution.detail.get_domain_late; +import beman.execution.detail.is_awaitable; +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +import beman.execution.detail.transform_sender; +#else +#include +#include +#include +#include +#include +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_delegation_scheduler.hpp b/include/beman/execution/detail/get_delegation_scheduler.hpp index 61c21874..c9e58e37 100644 --- a/include/beman/execution/detail/get_delegation_scheduler.hpp +++ b/include/beman/execution/detail/get_delegation_scheduler.hpp @@ -5,9 +5,18 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DELEGATION_SCHEDULER #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.forwarding_query; +import beman.execution.detail.scheduler; +#else #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_domain.hpp b/include/beman/execution/detail/get_domain.hpp index 932e1147..b16b25e1 100644 --- a/include/beman/execution/detail/get_domain.hpp +++ b/include/beman/execution/detail/get_domain.hpp @@ -5,10 +5,17 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN #include -#include -#include - #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.forwarding_query; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_domain_early.hpp b/include/beman/execution/detail/get_domain_early.hpp index fe617bb3..13e40915 100644 --- a/include/beman/execution/detail/get_domain_early.hpp +++ b/include/beman/execution/detail/get_domain_early.hpp @@ -5,10 +5,17 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN_EARLY #include +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.completion_domain; +import beman.execution.detail.default_domain; +import beman.execution.detail.get_domain; +import beman.execution.detail.get_env; +#else #include #include #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_domain_late.hpp b/include/beman/execution/detail/get_domain_late.hpp index a716f352..147c1767 100644 --- a/include/beman/execution/detail/get_domain_late.hpp +++ b/include/beman/execution/detail/get_domain_late.hpp @@ -5,14 +5,28 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN_LATE #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.completion_domain; +import beman.execution.detail.default_domain; +import beman.execution.detail.get_domain; +import beman.execution.detail.get_env; +import beman.execution.detail.get_scheduler; +import beman.execution.detail.sender_decompose; +import beman.execution.detail.tag_of_t; +#else #include -#include +#include #include +#include #include #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_env.hpp b/include/beman/execution/detail/get_env.hpp index ab030f53..cfb910c4 100644 --- a/include/beman/execution/detail/get_env.hpp +++ b/include/beman/execution/detail/get_env.hpp @@ -5,10 +5,19 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_ENV #include -#include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.env; +import beman.execution.detail.queryable; +#else +#include +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_scheduler.hpp b/include/beman/execution/detail/get_scheduler.hpp index 3ab03070..914cd5ee 100644 --- a/include/beman/execution/detail/get_scheduler.hpp +++ b/include/beman/execution/detail/get_scheduler.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_SCHEDULER #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.forwarding_query; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/get_stop_token.hpp b/include/beman/execution/detail/get_stop_token.hpp index b81bc5ea..010eb294 100644 --- a/include/beman/execution/detail/get_stop_token.hpp +++ b/include/beman/execution/detail/get_stop_token.hpp @@ -5,11 +5,21 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_STOP_TOKEN #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.forwarding_query; +import beman.execution.detail.never_stop_token; +import beman.execution.detail.stoppable_token; +#else #include #include #include -#include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/has_as_awaitable.hpp b/include/beman/execution/detail/has_as_awaitable.hpp index 447bdaca..049849bf 100644 --- a/include/beman/execution/detail/has_as_awaitable.hpp +++ b/include/beman/execution/detail/has_as_awaitable.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_AS_AWAITABLE #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.is_awaitable; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/has_completions.hpp b/include/beman/execution/detail/has_completions.hpp index 24d747ab..ae660fbc 100644 --- a/include/beman/execution/detail/has_completions.hpp +++ b/include/beman/execution/detail/has_completions.hpp @@ -5,8 +5,13 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_COMPLETIONS #include -#include +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.completion_signatures; +import beman.execution.detail.valid_completion_for; +#else #include +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/impls_for.hpp b/include/beman/execution/detail/impls_for.hpp index 3da8cdde..77588934 100644 --- a/include/beman/execution/detail/impls_for.hpp +++ b/include/beman/execution/detail/impls_for.hpp @@ -5,13 +5,51 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_IMPLS_FOR #include +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.default_impls; +#else #include +#endif // ---------------------------------------------------------------------------- namespace beman::execution::detail { template struct impls_for : ::beman::execution::detail::default_impls {}; + +template +struct get_impls_for { + static constexpr auto get_attrs() -> const auto& { + if constexpr (requires { Tag::impls_for::get_attrs; }) + return Tag::impls_for::get_attrs; + else + return ::beman::execution::detail::impls_for::get_attrs; + } + static constexpr auto start() -> const auto& { + if constexpr (requires { Tag::impls_for::start; }) + return Tag::impls_for::start; + else + return ::beman::execution::detail::impls_for::start; + } + static constexpr auto get_state() -> const auto& { + if constexpr (requires { Tag::impls_for::get_state; }) + return Tag::impls_for::get_state; + else + return ::beman::execution::detail::impls_for::get_state; + } + static constexpr auto get_env() -> const auto& { + if constexpr (requires { Tag::impls_for::get_env; }) + return Tag::impls_for::get_env; + else + return ::beman::execution::detail::impls_for::get_env; + } + static constexpr auto complete() -> const auto& { + if constexpr (requires { Tag::impls_for::complete; }) + return Tag::impls_for::complete; + else + return ::beman::execution::detail::impls_for::complete; + } +}; } // namespace beman::execution::detail // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/indices_for.hpp b/include/beman/execution/detail/indices_for.hpp index 8c1a12b6..499d34b4 100644 --- a/include/beman/execution/detail/indices_for.hpp +++ b/include/beman/execution/detail/indices_for.hpp @@ -5,7 +5,11 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_INDICES_FOR #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/inplace_stop_source.hpp b/include/beman/execution/detail/inplace_stop_source.hpp index f010dd53..053fa64e 100644 --- a/include/beman/execution/detail/inplace_stop_source.hpp +++ b/include/beman/execution/detail/inplace_stop_source.hpp @@ -5,12 +5,20 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_INPLACE_STOP_SOURCE #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.immovable; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/into_variant.hpp b/include/beman/execution/detail/into_variant.hpp index b494a9cb..814e7562 100644 --- a/include/beman/execution/detail/into_variant.hpp +++ b/include/beman/execution/detail/into_variant.hpp @@ -5,10 +5,40 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_INTO_VARIANT #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_sender; +import beman.execution.detail.child_type; +import beman.execution.detail.completion_signatures; +import beman.execution.detail.completion_signatures_for; +import beman.execution.detail.decayed_tuple; +import beman.execution.detail.default_impls; +import beman.execution.detail.env_of_t; +import beman.execution.detail.error_types_of_t; +import beman.execution.detail.get_domain_early; +import beman.execution.detail.impls_for; +import beman.execution.detail.make_sender; +import beman.execution.detail.meta.combine; +import beman.execution.detail.sender; +import beman.execution.detail.sends_stopped; +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +import beman.execution.detail.transform_sender; +import beman.execution.detail.value_types_of_t; +import beman.execution.detail.variant_or_empty; +#else #include #include -#include #include +#include #include #include #include @@ -21,11 +51,7 @@ #include #include #include - -#include -#include -#include -#include +#endif // ---------------------------------------------------------------------------- @@ -33,71 +59,84 @@ namespace beman::execution::detail { struct into_variant_t { template <::beman::execution::sender Sender> auto operator()(Sender&& sender) const { - auto domain{::beman::execution::detail::get_domain_early(sender)}; - (void)domain; + // auto domain{::beman::execution::detail::get_domain_early(sender)}; + //(void)domain; return ::beman::execution::detail::make_sender(*this, {}, ::std::forward(sender)); // return ::beman::execution::transform_sender( // ::std::move(domain), // ::beman::execution::detail::make_sender(*this, {}, ::std::forward(sender)) //); } -}; -template <> -struct impls_for<::beman::execution::detail::into_variant_t> : ::beman::execution::detail::default_impls { - struct get_state_impl { - template - auto operator()(Sender&&, Receiver&&) const noexcept -> ::std::type_identity< - ::beman::execution::value_types_of_t<::beman::execution::detail::child_type, - ::beman::execution::env_of_t>> { - return {}; + private: + template + using make_error_types = ::beman::execution::completion_signatures<::beman::execution::set_error_t(E)...>; + + private: + template + struct get_signatures; + template <::beman::execution::sender Child, typename State, typename Env> + struct get_signatures< + ::beman::execution::detail::basic_sender<::beman::execution::detail::into_variant_t, State, Child>, + Env> { + + static consteval auto get() { + using variant_type = ::beman::execution::value_types_of_t; + using value_types = ::std::conditional_t< + ::std::same_as, + ::beman::execution::completion_signatures<>, + ::beman::execution::completion_signatures<::beman::execution::set_value_t(variant_type)>>; + + using error_types = ::beman::execution::error_types_of_t; + using stopped_types = + ::std::conditional_t<::beman::execution::sends_stopped, + ::beman::execution::completion_signatures<::beman::execution::set_stopped_t()>, + ::beman::execution::completion_signatures<>>; + using type = ::beman::execution::detail::meta:: + combine>; + return type{}; } }; - static constexpr auto get_state{get_state_impl{}}; - struct complete_impl { - template - auto operator()(auto, State, auto& receiver, Tag, Args&&... args) const noexcept -> void { - if constexpr (::std::same_as) { - using variant_type = typename State::type; - using tuple_type = ::beman::execution::detail::decayed_tuple; - try { - if constexpr (sizeof...(Args) == 0u) - ::beman::execution::set_value(::std::move(receiver)); - else - ::beman::execution::set_value(::std::move(receiver), - variant_type(tuple_type{::std::forward(args)...})); - } catch (...) { - ::beman::execution::set_error(::std::move(receiver), ::std::current_exception()); - } - } else { - Tag()(::std::move(receiver), ::std::forward(args)...); + public: + template <::beman::execution::sender Sender, typename Env> + static consteval auto get_completion_signatures() { + return get_signatures<::std::remove_cvref_t, Env>::get(); + } + struct impls_for : ::beman::execution::detail::default_impls { + struct get_state_impl { + template + auto operator()(Sender&&, Receiver&&) const noexcept -> ::std::type_identity< + ::beman::execution::value_types_of_t<::beman::execution::detail::child_type, + ::beman::execution::env_of_t>> { + return {}; } - } + }; + static constexpr auto get_state{get_state_impl{}}; + struct complete_impl { + template + auto operator()(auto, State, auto& receiver, Tag, Args&&... args) const noexcept -> void { + if constexpr (::std::same_as) { + using variant_type = typename State::type; + using tuple_type = ::beman::execution::detail::decayed_tuple; + try { + if constexpr (sizeof...(Args) == 0u) + ::beman::execution::set_value(::std::move(receiver)); + else + ::beman::execution::set_value(::std::move(receiver), + variant_type(tuple_type{::std::forward(args)...})); + } catch (...) { + ::beman::execution::set_error(::std::move(receiver), ::std::current_exception()); + } + } else { + Tag()(::std::move(receiver), ::std::forward(args)...); + } + } + }; + static constexpr auto complete{complete_impl{}}; }; - static constexpr auto complete{complete_impl{}}; }; -template -struct completion_signatures_for_impl< - ::beman::execution::detail::basic_sender<::beman::execution::detail::into_variant_t, State, Sender>, - Env> { - using variant_type = ::beman::execution::value_types_of_t; - using value_types = - ::std::conditional_t<::std::same_as, - ::beman::execution::completion_signatures<>, - ::beman::execution::completion_signatures<::beman::execution::set_value_t(variant_type)>>; - template - using make_error_types = ::beman::execution::completion_signatures<::beman::execution::set_error_t(E)...>; - - using error_types = ::beman::execution::error_types_of_t; - using stopped_types = - ::std::conditional_t<::beman::execution::sends_stopped, - ::beman::execution::completion_signatures<::beman::execution::set_stopped_t()>, - ::beman::execution::completion_signatures<>>; - using type = ::beman::execution::detail::meta:: - combine>; -}; } // namespace beman::execution::detail namespace beman::execution { diff --git a/include/beman/execution/detail/intrusive_stack.hpp b/include/beman/execution/detail/intrusive_stack.hpp index 43a09a11..276a4d6f 100644 --- a/include/beman/execution/detail/intrusive_stack.hpp +++ b/include/beman/execution/detail/intrusive_stack.hpp @@ -5,8 +5,12 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_INTRUSIVE_QUEUE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif namespace beman::execution::detail { diff --git a/include/beman/execution/detail/is_awaitable.hpp b/include/beman/execution/detail/is_awaitable.hpp index 5d13b0d1..dd705b6f 100644 --- a/include/beman/execution/detail/is_awaitable.hpp +++ b/include/beman/execution/detail/is_awaitable.hpp @@ -5,9 +5,18 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_IS_AWAITABLE #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.get_awaiter; +import beman.execution.detail.is_awaiter; +#else #include #include -#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/is_awaiter.hpp b/include/beman/execution/detail/is_awaiter.hpp index e1efcd83..f42522a3 100644 --- a/include/beman/execution/detail/is_awaiter.hpp +++ b/include/beman/execution/detail/is_awaiter.hpp @@ -5,8 +5,16 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_IS_AWAITER #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.await_suspend_result; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/join_env.hpp b/include/beman/execution/detail/join_env.hpp index a582d08a..cf72f250 100644 --- a/include/beman/execution/detail/join_env.hpp +++ b/include/beman/execution/detail/join_env.hpp @@ -5,8 +5,12 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_JOIN_ENV #include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include +#endif // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/just.hpp b/include/beman/execution/detail/just.hpp index 9de59bb5..e670ff5e 100644 --- a/include/beman/execution/detail/just.hpp +++ b/include/beman/execution/detail/just.hpp @@ -5,18 +5,37 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_JUST #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else #include #include #include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.basic_sender; +import beman.execution.detail.completion_signatures; +import beman.execution.detail.completion_signatures_for; +import beman.execution.detail.default_impls; +import beman.execution.detail.impls_for; +import beman.execution.detail.make_sender; +import beman.execution.detail.movable_value; +import beman.execution.detail.product_type; +import beman.execution.detail.sender; +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif // ---------------------------------------------------------------------------- @@ -26,6 +45,7 @@ namespace beman::execution::detail { template concept just_size = (!::std::same_as or 1u == sizeof...(T)) && (!::std::same_as or 0u == sizeof...(T)); + template struct just_t { template @@ -39,27 +59,34 @@ struct just_t { static auto affine_on(Sender&& sndr, const auto&) noexcept { return ::std::forward(sndr); } -}; -template -struct completion_signatures_for_impl< - ::beman::execution::detail::basic_sender, ::beman::execution::detail::product_type>, - Env> { - using type = ::beman::execution::completion_signatures; -}; + private: + template + struct get_signatures; + template + struct get_signatures< + ::beman::execution::detail::basic_sender, ::beman::execution::detail::product_type>> { + using type = ::beman::execution::completion_signatures<::std::remove_cvref_t(T...)>; + }; -template -struct impls_for> : ::beman::execution::detail::default_impls { - struct start_impl { - template - auto operator()(State& state, auto& receiver) const noexcept -> void { - [&state, &receiver]<::std::size_t... I>(::std::index_sequence) { - Completion()(::std::move(receiver), ::std::move(state.template get())...); - }(::std::make_index_sequence{}); - } + public: + template <::beman::execution::sender Sender, typename...> + static consteval auto get_completion_signatures() { + return typename get_signatures<::std::remove_cvref_t>::type{}; + } + struct impls_for : ::beman::execution::detail::default_impls { + struct start_impl { + template + auto operator()(State& state, auto& receiver) const noexcept -> void { + [&state, &receiver]<::std::size_t... I>(::std::index_sequence) { + Completion()(::std::move(receiver), ::std::move(state.template get())...); + }(::std::make_index_sequence{}); + } + }; + static constexpr auto start{start_impl{}}; }; - static constexpr auto start{start_impl{}}; }; + } // namespace beman::execution::detail #include diff --git a/include/beman/execution/detail/let.hpp b/include/beman/execution/detail/let.hpp index 5d54d54c..fc7c1c69 100644 --- a/include/beman/execution/detail/let.hpp +++ b/include/beman/execution/detail/let.hpp @@ -5,42 +5,90 @@ #define INCLUDED_BEMAN_EXECUTION_DETAIL_LET #include -#include +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#include +#include +#include +#include +#include +#include +#endif +#ifdef BEMAN_HAS_MODULES +import beman.execution.detail.allocator_aware_move; +import beman.execution.detail.basic_sender; +import beman.execution.detail.call_result_t; +import beman.execution.detail.completion_signatures; +import beman.execution.detail.completion_signatures_for; +import beman.execution.detail.completion_signatures_of_t; +import beman.execution.detail.connect; +import beman.execution.detail.decayed_tuple; +import beman.execution.detail.default_impls; +import beman.execution.detail.emplace_from; +import beman.execution.detail.env; +import beman.execution.detail.env_of_t; +import beman.execution.detail.forward_like; +import beman.execution.detail.fwd_env; +import beman.execution.detail.get_env; +import beman.execution.detail.get_completion_scheduler; +import beman.execution.detail.get_completion_signatures; +import beman.execution.detail.get_domain; +import beman.execution.detail.get_domain_early; +import beman.execution.detail.impls_for; +import beman.execution.detail.join_env; +import beman.execution.detail.make_env; +import beman.execution.detail.make_sender; +import beman.execution.detail.meta.combine; +import beman.execution.detail.meta.filter; +import beman.execution.detail.meta.prepend; +import beman.execution.detail.meta.to; +import beman.execution.detail.meta.transform; +import beman.execution.detail.meta.unique; +import beman.execution.detail.movable_value; +import beman.execution.detail.receiver; +import beman.execution.detail.sched_env; +import beman.execution.detail.sender; +import beman.execution.detail.sender_adaptor; +import beman.execution.detail.set_error; +import beman.execution.detail.set_stopped; +import beman.execution.detail.set_value; +import beman.execution.detail.start; +import beman.execution.detail.transform_sender; +import beman.execution.detail.type_list; +#else #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include +#include #include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include #include -#include -#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#endif // ---------------------------------------------------------------------------- @@ -56,7 +104,7 @@ struct let_t { template <::beman::execution::sender Sender, ::beman::execution::detail::movable_value Fun> auto operator()(Sender&& sender, Fun&& fun) const { auto domain(::beman::execution::detail::get_domain_early(sender)); - return ::beman::execution::detail::transform_sender( + return ::beman::execution::transform_sender( domain, ::beman::execution::detail::make_sender(*this, ::std::forward(fun), std::forward(sender))); } @@ -84,156 +132,167 @@ struct let_t { static auto join_env(Sender&& sender, Env&& e) -> decltype(auto) { return ::beman::execution::detail::join_env(env(sender), ::beman::execution::detail::fwd_env(e)); } -}; - -template -struct impls_for<::beman::execution::detail::let_t> : ::beman::execution::detail::default_impls { - template - struct let_receiver { - using receiver_concept = ::beman::execution::receiver_t; + private: + template + struct get_signatures; + template + struct get_signatures< + ::beman::execution::detail::basic_sender<::beman::execution::detail::let_t, Fun, Child>, + Env> { + template + struct other_completion : ::std::true_type {}; + template + struct other_completion : ::std::false_type {}; + template + struct matching_completion : ::std::false_type {}; + template + struct matching_completion : ::std::true_type {}; - Receiver& receiver; - Env env; + template + struct apply_decayed; + template + struct apply_decayed { + using sender_type = ::beman::execution::detail::call_result_t...>; + }; + template + struct get_completions; + template