@@ -190,23 +190,48 @@ struct sender {
190190 }
191191};
192192
193- template <stdx::ct_string Name, stdx::callable Pred, stdx::callable LoopFn>
193+ template <stdx::ct_string, typename , stdx::callable> struct pipeable ;
194+
195+ template <stdx::ct_string Name, typename ... Args>
196+ constexpr auto make_sender (Args &&...args)
197+ -> sender<Name, std::remove_cvref_t<Args>...> {
198+ return {std::forward<Args>(args)...};
199+ }
200+
201+ template <stdx::ct_string Name, typename MatchValue, stdx::callable LoopFn>
194202struct pipeable {
203+ MatchValue v;
204+ LoopFn f;
205+
206+ private:
207+ template <async::sender S, stdx::same_as_unqualified<pipeable> Self>
208+ friend constexpr auto operator |(S &&s, Self &&self) -> async::sender auto {
209+ return make_sender<Name>(
210+ std::forward<S>(s),
211+ [value = std::forward<Self>(self).v ](auto const &x) {
212+ return x == value;
213+ },
214+ std::forward<Self>(self).f );
215+ }
216+ };
217+
218+ template <stdx::ct_string Name, stdx::callable Pred, stdx::callable LoopFn>
219+ struct pipeable <Name, Pred, LoopFn> {
195220 Pred p;
196221 LoopFn f;
197222
198223 private:
199224 template <async::sender S, stdx::same_as_unqualified<pipeable> Self>
200225 friend constexpr auto operator |(S &&s, Self &&self) -> async::sender auto {
201- return sender<Name, std::remove_cvref_t <S>, Pred, LoopFn>{
202- std::forward<S>(s), std::forward<Self>(self).p ,
203- std::forward<Self>(self).f };
226+ return make_sender<Name>(std::forward<S>(s), std::forward<Self>(self).p ,
227+ std::forward<Self>(self).f );
204228 }
205229};
206230} // namespace _repeat
207231
208232template <stdx::ct_string Name = " repeat_until" , typename P,
209233 typename F = std::remove_cvref_t <decltype (_repeat::no_loop_fn)>>
234+ requires (not sender<P>)
210235[[nodiscard]] constexpr auto repeat_until (P &&p, F &&f = {})
211236 -> _repeat::pipeable<Name, std::remove_cvref_t<P>, std::remove_cvref_t<F>> {
212237 return {std::forward<P>(p), std::forward<F>(f)};
0 commit comments