any_sender: add member connect() alongside tag_invoke(connect_t) friends#7292
any_sender: add member connect() alongside tag_invoke(connect_t) friends#7292guptapratykshh wants to merge 1 commit into
Conversation
Signed-off-by: guptapratykshh <pratykshgupta9999@gmail.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds rvalue/lvalue-qualified connect member functions to any_sender and unique_any_sender, keeping existing tag_invoke(connect_t, ...) overloads as delegating shims for compatibility with ADL and direct tag_invoke calls.
Changes:
- Introduced
connect(R&&) &/connect(R&&) &&member overloads forany_sender. - Introduced
connect(R&&) &&member overload forunique_any_sender. - Updated existing
tag_invoke(connect_t, ...)friends to delegate to the new memberconnectoverloads.
Up to standards ✅🟢 Issues
|
|
Can one of the admins verify this patch? |
| R&& r) | ||
| { | ||
| return HPX_MOVE(s).connect(HPX_FORWARD(R, r)); | ||
| } |
There was a problem hiding this comment.
I think you can remove the tag_invoke overloads now. @charan-003 could you confirm this, please?
| // Member connect overload (preferred by stdexec's connect CPO over | ||
| // the tag_invoke friend below). The CPO dispatches to the member | ||
| // when present, so this migration is purely additive -- the friend | ||
| // is kept as a thin delegate so existing direct | ||
| // tag_invoke(connect_t{}, ...) calls and ADL-based discovery keep | ||
| // working. |
There was a problem hiding this comment.
We can drop this comment
| template <typename R> | ||
| friend detail::any_operation_state tag_invoke( | ||
| hpx::execution::experimental::connect_t, unique_any_sender&& s, | ||
| R&& r) | ||
| { | ||
| return HPX_MOVE(s).connect(HPX_FORWARD(R, r)); | ||
| } |
There was a problem hiding this comment.
- tag_invoke is depricated
connect_talready prefers.connect()https://en.cppreference.com/w/cpp/header/execution
| template <typename R> | ||
| friend detail::any_operation_state tag_invoke( | ||
| hpx::execution::experimental::connect_t, any_sender& s, R&& r) | ||
| { | ||
| return s.connect(HPX_FORWARD(R, r)); | ||
| } | ||
|
|
||
| template <typename R> | ||
| friend detail::any_operation_state tag_invoke( | ||
| hpx::execution::experimental::connect_t, any_sender&& s, R&& r) | ||
| { | ||
| return HPX_MOVE(s).connect(HPX_FORWARD(R, r)); | ||
| } |
There was a problem hiding this comment.
friend only forwarded to member connect, so behavior is unchanged, and it will compile without those tag_invoke templates.
| // Member connect overloads (preferred by stdexec's connect CPO | ||
| // over the tag_invoke friends below). The friends are kept as | ||
| // thin delegates so existing direct tag_invoke(connect_t{}, ...) | ||
| // calls and ADL-based discovery keep working unchanged. See the | ||
| // matching pattern on unique_any_sender above. |
There was a problem hiding this comment.
we can drop this as well
Proposed Changes
connect(R&&)overloads tounique_any_sender(rvalue-qualified) andany_sender(lvalue- and rvalue-qualified) in any_sender.hpp. The bodies are identical to the existingtag_invoke(connect_t, ...)friend bodies; stdexec'sconnectCPO prefers a member when one is present, so the dispatch path switches to the member while the friend remains as a delegate.tag_invoke(connect_t, ...)friend overloads into one-line delegates to the corresponding member, so directtag_invoke(connect_t{}, sender, r)calls and ADL-based discovery keep working unchanged.tag_invokeoverloads toward stdexec-aligned member functions.Any background context you want to provide?
Checklist
Not all points below apply to all pull requests.