diff --git a/examples/benchmark/static_thread_pool.cpp b/examples/benchmark/static_thread_pool.cpp index 1a4da6a00..5ac167f55 100644 --- a/examples/benchmark/static_thread_pool.cpp +++ b/examples/benchmark/static_thread_pool.cpp @@ -16,6 +16,7 @@ */ #include "./common.hpp" #include + struct RunThread { void operator()( exec::static_thread_pool& pool, @@ -62,13 +63,13 @@ struct RunThread { while (scheds) { stdexec::start_detached( // stdexec::schedule(scheduler) // - | stdexec::then([&] { - auto prev = counter.fetch_sub(1); - if (prev == 1) { - std::lock_guard lock{mut}; - cv.notify_one(); - } - })); + | stdexec::then([&] { + auto prev = counter.fetch_sub(1); + if (prev == 1) { + std::lock_guard lock{mut}; + cv.notify_one(); + } + })); --scheds; } #endif @@ -80,7 +81,6 @@ struct RunThread { } }; - int main(int argc, char** argv) { my_main(argc, argv); } \ No newline at end of file diff --git a/examples/benchmark/static_thread_pool_bulk_enqueue.cpp b/examples/benchmark/static_thread_pool_bulk_enqueue.cpp index ef57d3e57..44efdfef9 100644 --- a/examples/benchmark/static_thread_pool_bulk_enqueue.cpp +++ b/examples/benchmark/static_thread_pool_bulk_enqueue.cpp @@ -37,16 +37,15 @@ struct RunThread { break; } #ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE - pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()}; + pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()}; pmr::polymorphic_allocator alloc{&rsrc}; auto env = exec::make_env(exec::with(stdexec::get_allocator, alloc)); auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism()); - auto iterate = exec::schedule_all(pool, std::views::iota(start, end)) - | exec::ignore_all_values() - | exec::write(env); + auto iterate = exec::schedule_all(pool, std::views::iota(start, end)) + | exec::ignore_all_values() | exec::write(env); #else auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism()); - auto iterate = exec::schedule_all(pool, std::views::iota(start, end)) + auto iterate = exec::schedule_all(pool, std::views::iota(start, end)) | exec::ignore_all_values(); #endif stdexec::sync_wait(iterate); @@ -59,5 +58,6 @@ int main(int argc, char** argv) { my_main(argc, argv); } #else -int main() {} +int main() { +} #endif \ No newline at end of file diff --git a/examples/benchmark/static_thread_pool_bulk_enqueue_nested.cpp b/examples/benchmark/static_thread_pool_bulk_enqueue_nested.cpp index 7fe511d26..842e73562 100644 --- a/examples/benchmark/static_thread_pool_bulk_enqueue_nested.cpp +++ b/examples/benchmark/static_thread_pool_bulk_enqueue_nested.cpp @@ -38,17 +38,15 @@ struct RunThread { break; } #ifndef STDEXEC_NO_MONOTONIC_BUFFER_RESOURCE - pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()}; + pmr::monotonic_buffer_resource rsrc{buffer.data(), buffer.size()}; pmr::polymorphic_allocator alloc{&rsrc}; auto env = exec::make_env(exec::with(stdexec::get_allocator, alloc)); auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism()); - auto iterate = exec::iterate(std::views::iota(start, end)) - | exec::ignore_all_values() + auto iterate = exec::iterate(std::views::iota(start, end)) | exec::ignore_all_values() | exec::write(env); #else auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism()); - auto iterate = exec::iterate(std::views::iota(start, end)) - | exec::ignore_all_values(); + auto iterate = exec::iterate(std::views::iota(start, end)) | exec::ignore_all_values(); #endif stdexec::sync_wait(stdexec::on(scheduler, iterate)); barrier.arrive_and_wait(); @@ -60,5 +58,6 @@ int main(int argc, char** argv) { my_main(argc, argv); } #else -int main() {} +int main() { +} #endif \ No newline at end of file diff --git a/examples/benchmark/static_thread_pool_nested.cpp b/examples/benchmark/static_thread_pool_nested.cpp index 17afc78fc..a248e00f8 100644 --- a/examples/benchmark/static_thread_pool_nested.cpp +++ b/examples/benchmark/static_thread_pool_nested.cpp @@ -48,15 +48,15 @@ struct RunThread { | stdexec::then([&] { auto nested_scheduler = pool.get_scheduler(); while (scheds) { - stdexec::start_detached( // + stdexec::start_detached( // stdexec::schedule(nested_scheduler) // - | stdexec::then([&] { - auto prev = counter.fetch_sub(1); - if (prev == 1) { - std::lock_guard lock{mut}; - cv.notify_one(); - } - }), + | stdexec::then([&] { + auto prev = counter.fetch_sub(1); + if (prev == 1) { + std::lock_guard lock{mut}; + cv.notify_one(); + } + }), env); --scheds; } @@ -70,7 +70,7 @@ struct RunThread { | stdexec::then([&] { auto nested_scheduler = pool.get_scheduler(); while (scheds) { - stdexec::start_detached( // + stdexec::start_detached( // stdexec::schedule(nested_scheduler) // | stdexec::then([&] { auto prev = counter.fetch_sub(1); diff --git a/examples/benchmark/static_thread_pool_nested_old.cpp b/examples/benchmark/static_thread_pool_nested_old.cpp index 0a2f7a03a..9dfe6ecfd 100644 --- a/examples/benchmark/static_thread_pool_nested_old.cpp +++ b/examples/benchmark/static_thread_pool_nested_old.cpp @@ -47,15 +47,15 @@ struct RunThread { stdexec::schedule(scheduler) // | stdexec::then([&] { while (scheds) { - stdexec::start_detached( // + stdexec::start_detached( // stdexec::schedule(scheduler) // - | stdexec::then([&] { - auto prev = counter.fetch_sub(1); - if (prev == 1) { - std::lock_guard lock{mut}; - cv.notify_one(); - } - }), + | stdexec::then([&] { + auto prev = counter.fetch_sub(1); + if (prev == 1) { + std::lock_guard lock{mut}; + cv.notify_one(); + } + }), env); --scheds; } @@ -68,7 +68,7 @@ struct RunThread { stdexec::schedule(scheduler) // | stdexec::then([&] { while (scheds) { - stdexec::start_detached( // + stdexec::start_detached( // stdexec::schedule(scheduler) // | stdexec::then([&] { auto prev = counter.fetch_sub(1); diff --git a/examples/benchmark/static_thread_pool_old.cpp b/examples/benchmark/static_thread_pool_old.cpp index b2b47b2be..8ffa6162f 100644 --- a/examples/benchmark/static_thread_pool_old.cpp +++ b/examples/benchmark/static_thread_pool_old.cpp @@ -63,13 +63,13 @@ struct RunThread { while (scheds) { stdexec::start_detached( // stdexec::schedule(scheduler) // - | stdexec::then([&] { - auto prev = counter.fetch_sub(1); - if (prev == 1) { - std::lock_guard lock{mut}; - cv.notify_one(); - } - })); + | stdexec::then([&] { + auto prev = counter.fetch_sub(1); + if (prev == 1) { + std::lock_guard lock{mut}; + cv.notify_one(); + } + })); --scheds; } #endif diff --git a/examples/benchmark/tbb_thread_pool.cpp b/examples/benchmark/tbb_thread_pool.cpp index 62c343f76..de77c48d7 100644 --- a/examples/benchmark/tbb_thread_pool.cpp +++ b/examples/benchmark/tbb_thread_pool.cpp @@ -63,13 +63,13 @@ struct RunThread { while (scheds) { stdexec::start_detached( // stdexec::schedule(scheduler) // - | stdexec::then([&] { - auto prev = counter.fetch_sub(1); - if (prev == 1) { - std::lock_guard lock{mut}; - cv.notify_one(); - } - })); + | stdexec::then([&] { + auto prev = counter.fetch_sub(1); + if (prev == 1) { + std::lock_guard lock{mut}; + cv.notify_one(); + } + })); --scheds; } #endif @@ -81,7 +81,6 @@ struct RunThread { } }; -int main(int argc, char** argv) -{ +int main(int argc, char** argv) { my_main(argc, argv); } \ No newline at end of file diff --git a/examples/benchmark/tbb_thread_pool_nested.cpp b/examples/benchmark/tbb_thread_pool_nested.cpp index 8c50e7f81..edf98654a 100644 --- a/examples/benchmark/tbb_thread_pool_nested.cpp +++ b/examples/benchmark/tbb_thread_pool_nested.cpp @@ -40,7 +40,7 @@ struct RunThread { auto [start, end] = exec::even_share(total_scheds, tid, pool.available_parallelism()); std::size_t scheds = end - start; tbb::task_group tg{}; - stdexec::sync_wait( // + stdexec::sync_wait( // stdexec::schedule(scheduler) // | stdexec::then([&] { for (std::size_t i = 0; i < scheds; ++i) { @@ -55,7 +55,6 @@ struct RunThread { } }; -int main(int argc, char** argv) -{ +int main(int argc, char** argv) { my_main(argc, argv); } \ No newline at end of file diff --git a/include/exec/__detail/__atomic_intrusive_queue.hpp b/include/exec/__detail/__atomic_intrusive_queue.hpp index c060eff7f..f5cdf50f9 100644 --- a/include/exec/__detail/__atomic_intrusive_queue.hpp +++ b/include/exec/__detail/__atomic_intrusive_queue.hpp @@ -40,7 +40,9 @@ namespace exec { try_push_result try_push_front(__node_pointer t) noexcept { __node_pointer __old_head = __head_.load(std::memory_order_relaxed); t->*_NextPtr = __old_head; - return {__head_.compare_exchange_strong(__old_head, t, std::memory_order_acq_rel), __old_head == nullptr}; + return { + __head_.compare_exchange_strong(__old_head, t, std::memory_order_acq_rel), + __old_head == nullptr}; } bool push_front(__node_pointer t) noexcept { diff --git a/include/exec/__detail/__bwos_lifo_queue.hpp b/include/exec/__detail/__bwos_lifo_queue.hpp index 02d7bff2c..4cb2fbf55 100644 --- a/include/exec/__detail/__bwos_lifo_queue.hpp +++ b/include/exec/__detail/__bwos_lifo_queue.hpp @@ -384,8 +384,7 @@ namespace exec::bwos { template template - Iterator - lifo_queue::block_type::bulk_put(Iterator first, Sentinel last) noexcept { + Iterator lifo_queue::block_type::bulk_put(Iterator first, Sentinel last) noexcept { std::uint64_t back = tail_.load(std::memory_order_relaxed); while (first != last && back < block_size()) { ring_buffer_[back] = static_cast(*first); diff --git a/include/exec/static_thread_pool.hpp b/include/exec/static_thread_pool.hpp index 477f96884..87fcd4857 100644 --- a/include/exec/static_thread_pool.hpp +++ b/include/exec/static_thread_pool.hpp @@ -252,7 +252,7 @@ namespace exec { } else { static_assert( // stdexec::__starts_on - || stdexec::__completes_on, + || stdexec::__completes_on, "No static_thread_pool instance can be found in the sender's or receiver's " "environment on which to schedule bulk work."); return not_a_sender>(); @@ -615,7 +615,7 @@ namespace exec { static thread_local std::thread::id this_id = std::this_thread::get_id(); std::size_t nTasks = 0; std::size_t idx = 0; - for ([[maybe_unused]] auto t : tasks) { + for ([[maybe_unused]] auto t: tasks) { ++nTasks; } for (std::thread& t: threads_) { @@ -653,7 +653,7 @@ namespace exec { inline static_thread_pool::thread_state::pop_result static_thread_pool::thread_state::try_remote() { pop_result result{nullptr, index_}; - __intrusive_queue<&task_base::next> remotes = pool_->remotes_.pop_all_reversed(index_); + __intrusive_queue<& task_base::next> remotes = pool_->remotes_.pop_all_reversed(index_); pending_queue_.append(std::move(remotes)); if (!pending_queue_.empty()) { move_pending_to_local(pending_queue_, local_queue_); diff --git a/include/nvexec/stream/when_all.cuh b/include/nvexec/stream/when_all.cuh index 34597bda9..f7f2bbb72 100644 --- a/include/nvexec/stream/when_all.cuh +++ b/include/nvexec/stream/when_all.cuh @@ -53,9 +53,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { template struct completions { using InvalidArg = // - __minvoke< - __mfind_if<__mbind_back_q, __q<__mfront>>, - Senders...>; + __minvoke< __mfind_if<__mbind_back_q, __q<__mfront>>, Senders...>; using __t = stdexec::__when_all::__too_many_value_completions_error; }; @@ -67,7 +65,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { } template - requires (!__v> &&...) + requires(!__v> && ...) struct completions { using non_values = // __concat_completion_signatures_t< diff --git a/include/stdexec/__detail/__basic_sender.hpp b/include/stdexec/__detail/__basic_sender.hpp index 8ea093657..9add78307 100644 --- a/include/stdexec/__detail/__basic_sender.hpp +++ b/include/stdexec/__detail/__basic_sender.hpp @@ -188,8 +188,7 @@ namespace stdexec { template template - constexpr auto - __make_sexpr_t<_Tag>::operator()(_Data __data, _Children... __children) const { + constexpr auto __make_sexpr_t<_Tag>::operator()(_Data __data, _Children... __children) const { return __sexpr{__make_tuple(_Tag(), __detail::__mbc(__data), __detail::__mbc(__children)...)}; } #else @@ -212,8 +211,7 @@ namespace stdexec { template template - constexpr auto - __make_sexpr_t<_Tag>::operator()(_Data __data, _Children... __children) const { + constexpr auto __make_sexpr_t<_Tag>::operator()(_Data __data, _Children... __children) const { return __sexpr{__make_tuple(_Tag(), (_Data&&) __data, (_Children&&) __children...)}; }; #endif diff --git a/include/stdexec/__detail/__p2300.hpp b/include/stdexec/__detail/__p2300.hpp index d9e6d619c..ed653019d 100644 --- a/include/stdexec/__detail/__p2300.hpp +++ b/include/stdexec/__detail/__p2300.hpp @@ -89,7 +89,8 @@ namespace std { using stop_token_of_t STDEXEC_STD_DEPRECATED = stdexec::stop_token_of_t<_StopTokenProvider>; // [exec.env], execution environments - struct __no_env {}; + struct __no_env { }; + using no_env STDEXEC_STD_DEPRECATED = __no_env; using get_env_t STDEXEC_STD_DEPRECATED = stdexec::get_env_t; //using forwarding_env_query_t STDEXEC_STD_DEPRECATED = stdexec::forwarding_env_query_t; // BUGBUG @@ -166,14 +167,14 @@ namespace std { template < // class _Sender, // - class _Env = __no_env, // + class _Env = __no_env, // template class _Tuple = stdexec::__decayed_tuple, // template class _Variant = stdexec::__variant> using value_types_of_t STDEXEC_STD_DEPRECATED = stdexec::value_types_of_t<_Sender, _Env, _Tuple, _Variant>; - template < // - class _Sender, // + template < // + class _Sender, // class _Env = __no_env, // template class _Variant = stdexec::__variant> using error_types_of_t STDEXEC_STD_DEPRECATED = diff --git a/include/stdexec/execution.hpp b/include/stdexec/execution.hpp index d6c12bdfc..a926ba53f 100644 --- a/include/stdexec/execution.hpp +++ b/include/stdexec/execution.hpp @@ -92,18 +92,17 @@ namespace stdexec { template concept __has_default_transform_sender = // - sender_expr<_Sender> // + sender_expr<_Sender> // && __has_transform_sender<__tag_of<_Sender>, _Sender, _Env...>; template - concept __has_transform_env = - requires(_Type __obj, _Sender&& __sender, _Env&& __env) { - __obj.transform_env((_Sender&&) __sender, (_Env&&) __env); - }; + concept __has_transform_env = requires(_Type __obj, _Sender&& __sender, _Env&& __env) { + __obj.transform_env((_Sender&&) __sender, (_Env&&) __env); + }; template concept __has_default_transform_env = // - sender_expr<_Sender> // + sender_expr<_Sender> // && __has_transform_env<__tag_of<_Sender>, _Sender, _Env>; template @@ -623,16 +622,11 @@ namespace stdexec { ///////////////////////////////////////////////////////////////////////////// template concept __completes_on = - __decays_to< - __call_result_t, env_of_t<_Sender>>, - _Scheduler>; + __decays_to< __call_result_t, env_of_t<_Sender>>, _Scheduler>; ///////////////////////////////////////////////////////////////////////////// template - concept __starts_on = - __decays_to< - __call_result_t, - _Scheduler>; + concept __starts_on = __decays_to< __call_result_t, _Scheduler>; ///////////////////////////////////////////////////////////////////////////// inline constexpr struct __get_env_domain_t { @@ -927,7 +921,7 @@ namespace stdexec { using __concat_completion_signatures_impl_t = // __minvoke< __if_c< - (__valid_completion_signatures<_Completions> &&...), + (__valid_completion_signatures<_Completions> && ...), __mconcat<__munique<__q>>, _INVALID_COMPLETION_SIGNATURES_TYPE_<>>, _Completions...>; @@ -974,7 +968,7 @@ namespace stdexec { template concept receiver = - enable_receiver<__decay_t<_Receiver>> && // + enable_receiver<__decay_t<_Receiver>> && // environment_provider<__cref_t<_Receiver>> && // move_constructible<__decay_t<_Receiver>> && // constructible_from<__decay_t<_Receiver>, _Receiver>; @@ -1200,8 +1194,8 @@ namespace stdexec { struct dependent_domain { template requires same_as<__sender_domain_of_t<_Sender>, dependent_domain> - STDEXEC_ATTRIBUTE((always_inline)) - decltype(auto) transform_sender(_Sender&& __sndr, const _Env& __env) const; + STDEXEC_ATTRIBUTE((always_inline)) decltype(auto) + transform_sender(_Sender&& __sndr, const _Env& __env) const; }; ///////////////////////////////////////////////////////////////////////////// @@ -1223,8 +1217,7 @@ namespace stdexec { struct __transform_sender { template STDEXEC_ATTRIBUTE((always_inline)) - /*constexpr*/ decltype(auto) - operator()(_Domain __dom, _Sender&& __sndr) const { + /*constexpr*/ decltype(auto) operator()(_Domain __dom, _Sender&& __sndr) const { if constexpr (__domain::__has_transform_sender<_Domain, _Sender>) { return __dom.transform_sender((_Sender&&) __sndr); } else { @@ -1254,9 +1247,7 @@ namespace stdexec { operator()(_Domain __dom, _Sender&& __sndr, const _Env& __env) const { static_assert(__none_of<_Domain, dependent_domain>); return __transform_sender()( - __dom, - dependent_domain().transform_sender((_Sender&&) __sndr, __env), - __env); + __dom, dependent_domain().transform_sender((_Sender&&) __sndr, __env), __env); } }; } // namespace __domain @@ -1275,7 +1266,7 @@ namespace stdexec { inline constexpr __domain::__transform_env transform_env{}; - struct _CHILD_SENDERS_WITH_DIFFERENT_DOMAINS_ {}; + struct _CHILD_SENDERS_WITH_DIFFERENT_DOMAINS_ { }; template requires same_as<__sender_domain_of_t<_Sender>, dependent_domain> @@ -1289,8 +1280,7 @@ namespace stdexec { [&](_Tag, _Data&& __data, _Childs&&... __childs) { // TODO: propagate meta-exceptions here: auto __sndr2 = __make_sexpr<_Tag>( - (_Data&&) __data, - __domain::__transform_sender()(*this, (_Childs&&) __childs, __env2)...); + (_Data&&) __data, __domain::__transform_sender()(*this, (_Childs&&) __childs, __env2)...); using _Sender2 = decltype(__sndr2); auto __domain2 = __sexpr_apply(__sndr2, __domain::__common_domain_fn()); @@ -1417,17 +1407,18 @@ namespace stdexec { template concept sender = - enable_sender<__decay_t<_Sender>> && // + enable_sender<__decay_t<_Sender>> && // environment_provider<__cref_t<_Sender>> && // move_constructible<__decay_t<_Sender>> && // constructible_from<__decay_t<_Sender>, _Sender>; template - concept sender_in = // + concept sender_in = // sender<_Sender> && // requires(_Sender&& __sndr, _Env&& __env) { - { get_completion_signatures((_Sender&&) __sndr, (_Env&&) __env) } - -> __valid_completion_signatures; + { + get_completion_signatures((_Sender&&) __sndr, (_Env&&) __env) + } -> __valid_completion_signatures; }; #if STDEXEC_ENABLE_EXTRA_TYPE_CHECKING() @@ -1624,14 +1615,7 @@ namespace stdexec { class _SetError = __q<__default_set_error>, // class _SetStopped = completion_signatures> // using __try_make_completion_signatures = // - __meval< - __compl_sigs_t, - _Sender, - _Env, - _Sigs, - _SetValue, - _SetError, - _SetStopped>; + __meval< __compl_sigs_t, _Sender, _Env, _Sigs, _SetValue, _SetError, _SetStopped>; } // namespace __compl_sigs using __compl_sigs::__try_make_completion_signatures; @@ -1704,7 +1688,7 @@ namespace stdexec { template < // class _Sender, // class _Env = __default_env, // - __valid_completion_signatures _Sigs = completion_signatures<>, // + __valid_completion_signatures _Sigs = completion_signatures<>, // template class _SetValue = __compl_sigs::__default_set_value, // template class _SetError = __compl_sigs::__default_set_error, // __valid_completion_signatures _SetStopped = completion_signatures> @@ -2049,9 +2033,9 @@ namespace stdexec { template static constexpr auto __select_impl() noexcept { - #if STDEXEC_ENABLE_EXTRA_TYPE_CHECKING() +#if STDEXEC_ENABLE_EXTRA_TYPE_CHECKING() static_assert(__check_signatures<_Sender, env_of_t<_Receiver>>()); - #endif +#endif using _Domain = __env_domain_of_t>; constexpr bool _NothrowTfxSender = @@ -2476,7 +2460,8 @@ namespace stdexec { auto&& __env = get_env(__op->__rcvr_); auto __alloc = get_allocator(__env); using _Alloc = decltype(__alloc); - using _OpAlloc = typename std::allocator_traits<_Alloc>::template rebind_alloc<_Operation>; + using _OpAlloc = + typename std::allocator_traits<_Alloc>::template rebind_alloc<_Operation>; _OpAlloc __op_alloc{__alloc}; std::allocator_traits<_OpAlloc>::destroy(__op_alloc, __op); std::allocator_traits<_OpAlloc>::deallocate(__op_alloc, __op, 1); @@ -2527,7 +2512,7 @@ namespace stdexec { } } else { start((new __operation<__id<_Sender>, __id<_Receiver>>{ - (_Sender&&) __sndr, (_Receiver&&) __rcvr}) + (_Sender&&) __sndr, (_Receiver&&) __rcvr}) ->__op_state_); } } @@ -4579,8 +4564,7 @@ namespace stdexec { // FUTURE: when we have a scheduler query for "always completes inline", // then we can use that instead of hard-coding `__inln::__scheduler` here. template - concept __unknown_context = - __one_of<_Scheduler, __none_such, __inln::__scheduler>; + concept __unknown_context = __one_of<_Scheduler, __none_such, __inln::__scheduler>; // The receiver that gets connected to the result sender is the input receiver, // possibly augmented with the input sender's completion scheduler (which is @@ -4776,11 +4760,11 @@ namespace stdexec { template using __completions = // - __mapply< - __transform< - __mbind_front_q<__tfx_signal_t, _Env, _Fun, _Set, __completion_sched<_Sender>>, - __q<__concat_completion_signatures_t> >, - __completion_signatures_of_t<_Sender, _Env>>; + __mapply< + __transform< + __mbind_front_q<__tfx_signal_t, _Env, _Fun, _Set, __completion_sched<_Sender>>, + __q<__concat_completion_signatures_t> >, + __completion_signatures_of_t<_Sender, _Env>>; template <__decays_to_derived_from<__sender_base> _Self, receiver _Receiver> requires sender_to<__copy_cvref_t<_Self, _Sender>, __receiver_t<_Self, _Receiver>> @@ -4816,7 +4800,8 @@ namespace stdexec { struct __t : __sender_base, _Fun, _SetId> { using __id = __sender; - friend auto tag_invoke(get_env_t, const __t& __self) noexcept /*-> env_of_t*/ { + friend auto tag_invoke(get_env_t, const __t& __self) noexcept + /*-> env_of_t*/ { return __join_env(__mkprop(_Domain(), get_domain), get_env(__self.__sndr_)); } }; @@ -4843,7 +4828,10 @@ namespace stdexec { auto operator()(_Sender&& __sndr, _Fun __fun) const { auto __domain = __get_sender_domain((_Sender&&) __sndr); return stdexec::transform_sender( - __domain, __sender<_Sender, _Fun>{{(_Sender&&) __sndr, (_Fun&&) __fun}}); + __domain, + __sender<_Sender, _Fun>{ + {(_Sender&&) __sndr, (_Fun&&) __fun} + }); } template @@ -4854,15 +4842,12 @@ namespace stdexec { // Compute all the domains of all the result senders and make sure they're all the same template - using __result_domain_t = - __gather_completions_for< - _SetTag, - _Child, - _Env, - __mtry_catch< - __mbind_front_q<__call_result_t, _Fun>, - __on_not_callable<_SetTag>>, - __q<__domain::__common_domain_t>>; + using __result_domain_t = __gather_completions_for< + _SetTag, + _Child, + _Env, + __mtry_catch< __mbind_front_q<__call_result_t, _Fun>, __on_not_callable<_SetTag>>, + __q<__domain::__common_domain_t>>; static auto get_env(__ignore) noexcept { return __mkprop(dependent_domain(), get_domain); @@ -4872,19 +4857,20 @@ namespace stdexec { static decltype(auto) transform_env(_Sender&& __sndr, const _Env& __env) { return __sexpr_apply( (_Sender&&) __sndr, - [&] _Child>(__ignore, _Fun&&, _Child&& __child) -> decltype(auto) { + [&] _Child>( + __ignore, _Fun&&, _Child&& __child) -> decltype(auto) { using _Scheduler = __completion_sched<_Child, _SetTag>; if constexpr (__unknown_context<_Scheduler>) { return (__env); } else { return __join_env( - __mkprop(get_completion_scheduler<_SetTag>(stdexec::get_env(__child)), get_scheduler), + __mkprop( + get_completion_scheduler<_SetTag>(stdexec::get_env(__child)), get_scheduler), __mkprop(get_domain), __env); } STDEXEC_UNREACHABLE(); - } - ); + }); } template _Sender, class _Env> @@ -4896,7 +4882,9 @@ namespace stdexec { // TODO: propagate errors here using _Domain = __result_domain_t<_Child, _Fun, _Env>; static_assert(__none_of<_Domain, __none_such, dependent_domain>); - return __sender<_Child, _Fun, _Domain>{{(_Child&&) __child, (_Fun&&) __fun}}; + return __sender<_Child, _Fun, _Domain>{ + {(_Child&&) __child, (_Fun&&) __fun} + }; }); } }; @@ -5045,14 +5033,13 @@ namespace stdexec { using __set_error_t = completion_signatures; template _Self, class _Env> - static auto get_completion_signatures(_Self&&, _Env&&) - -> make_completion_signatures< - __child_of<_Self>, - _Env, - completion_signatures, - __set_value_t, - __set_error_t, - completion_signatures<>> { + static auto get_completion_signatures(_Self&&, _Env&&) -> make_completion_signatures< + __child_of<_Self>, + _Env, + completion_signatures, + __set_value_t, + __set_error_t, + completion_signatures<>> { return {}; } }; @@ -5839,7 +5826,9 @@ namespace stdexec { STDEXEC_ATTRIBUTE((always_inline)) auto __mkenv_sched(_Scheduler __sched) { auto __env = __join_env(__mkprop(__sched, get_scheduler), __mkprop(get_domain)); + struct __env_t : decltype(__env) { }; + return __env_t{__env}; } } @@ -6720,8 +6709,8 @@ namespace stdexec { auto __domain = __get_env_domain(__env); auto __tfx = __make_transformer(__domain, __env); return __tfx(transfer_when_all_t())( - get_completion_scheduler((_Data&&) __data), - __tfx(into_variant)((_Child&&) __child)...); + get_completion_scheduler((_Data&&) __data), + __tfx(into_variant)((_Child&&) __child)...); }); } }; @@ -6983,10 +6972,9 @@ namespace stdexec { auto __old = get_scheduler(__env); auto __tfx = __make_transformer(__domain, __env); return __tfx(transfer)( - __tfx(let_value)( - __tfx(transfer_just)(std::move(__sched)), - __always{(_Child&&) __child}), - std::move(__old)); + __tfx(let_value)( + __tfx(transfer_just)(std::move(__sched)), __always{(_Child&&) __child}), + std::move(__old)); }); } }; @@ -7039,8 +7027,8 @@ namespace stdexec { auto __tfx = __make_transformer(__domain, __env); return __write( __tfx(transfer)( - ((_Closure&&) __clsur)( - __tfx(transfer)(__write((_Child&&) __child, __detail::__mkenv_sched(__old)), __sched)), + ((_Closure&&) __clsur)(__tfx(transfer)( + __write((_Child&&) __child, __detail::__mkenv_sched(__old)), __sched)), __old), __detail::__mkenv_sched(__sched)); }), @@ -7070,6 +7058,7 @@ namespace stdexec { struct __env : __result_of<__make_env, run_loop&> { __env(); + __env(run_loop& __loop) noexcept : __result_of<__make_env, run_loop&>{__sync_wait::__make_env(__loop)} { } diff --git a/test/stdexec/algos/consumers/test_start_detached.cpp b/test/stdexec/algos/consumers/test_start_detached.cpp index bc3a8e6f5..34b6bafeb 100644 --- a/test/stdexec/algos/consumers/test_start_detached.cpp +++ b/test/stdexec/algos/consumers/test_start_detached.cpp @@ -165,8 +165,8 @@ namespace { CHECK_FALSE(called); } -#if STDEXEC_HAS_STD_MEMORY_RESOURCE() && \ - (defined(__cpp_lib_polymorphic_allocator) && __cpp_lib_polymorphic_allocator >= 201902L) +#if STDEXEC_HAS_STD_MEMORY_RESOURCE() \ + && (defined(__cpp_lib_polymorphic_allocator) && __cpp_lib_polymorphic_allocator >= 201902L) struct counting_resource : std::pmr::memory_resource { counting_resource() = default; @@ -178,16 +178,18 @@ namespace { std::size_t get_alive() const noexcept { return alive; } - private: + private: void* do_allocate(std::size_t bytes, std::size_t alignment) override { ++count; ++alive; return std::pmr::new_delete_resource()->allocate(bytes, alignment); } + void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) override { --alive; return std::pmr::new_delete_resource()->deallocate(p, bytes, alignment); } + bool do_is_equal(const memory_resource& other) const noexcept override { return this == &other; } diff --git a/test/test_common/schedulers.hpp b/test/test_common/schedulers.hpp index 678a194c0..e9dae881e 100644 --- a/test/test_common/schedulers.hpp +++ b/test/test_common/schedulers.hpp @@ -50,6 +50,7 @@ namespace { explicit data(int id) : id_(id) { } + int id_; cmd_vec_t all_commands_; std::mutex mutex_; diff --git a/test/test_scratch.cpp b/test/test_scratch.cpp index 0bac03838..1330ee7fd 100644 --- a/test/test_scratch.cpp +++ b/test/test_scratch.cpp @@ -23,9 +23,7 @@ namespace ex = stdexec; namespace { - TEST_CASE( - "a scratch test case for minimal repro of a bug", - "[scratch]") { + TEST_CASE("a scratch test case for minimal repro of a bug", "[scratch]") { CHECK(true); } }