/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License Version 2.0 with LLVM Exceptions * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * https://llvm.org/LICENSE.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include #include #include #include #include #include #include namespace unifex { namespace _bulk_join { template struct _join_receiver { class type; }; template using join_receiver = typename _join_receiver::type; template class _join_receiver::type { public: template(typename Receiver2) // (requires constructible_from< Receiver, Receiver2>) // explicit type(Receiver2&& r) noexcept( std::is_nothrow_constructible_v) : receiver_((Receiver2 &&) r) {} void set_next() & noexcept {} template(typename... Values) // (requires receiver_of) // void set_value(Values&&... values) noexcept( is_nothrow_receiver_of_v) { unifex::set_value(std::move(receiver_), (Values &&) values...); } template(typename Error) // (requires receiver) // void set_error(Error&& error) noexcept { unifex::set_error(std::move(receiver_), (Error &&) error); } void set_done() noexcept { unifex::set_done(std::move(receiver_)); } friend constexpr unifex::parallel_unsequenced_policy tag_invoke( tag_t, [[maybe_unused]] const type& r) noexcept { return {}; } template(typename CPO, typename Self) // (requires is_receiver_query_cpo_v AND same_as< Self, type>) // friend auto tag_invoke(CPO cpo, const Self& self) noexcept( std::is_nothrow_invocable_v) -> std::invoke_result_t { return cpo(self.receiver_); } private: Receiver receiver_; }; template struct _join_sender { class type; }; template using join_sender = typename _join_sender::type; template class _join_sender::type { public: template < template class Variant, template class Tuple> using value_types = sender_value_types_t; template