Skip to content

receiver/sender constraint that checks get_env(rcvr) is valid redundantly checks the result is queryable #322

Open
@lewissbaker

Description

@lewissbaker

The concept for receiver and sender both check that get_env(o) is valid and returns a type that satisfies queryable. e.g.

// [exec.recv.concepts]
template<class Rcvr>
    concept receiver =
      derived_from<typename remove_cvref_t<Rcvr>::receiver_concept, receiver_t> &&
      requires(const remove_cvref_t<Rcvr>& rcvr) {
        { get_env(rcvr) } -> queryable;
      } &&
      move_constructible<remove_cvref_t<Rcvr>> &&       // rvalues are movable, and
      constructible_from<remove_cvref_t<Rcvr>, Rcvr>;   // lvalues are copyable

However, the get_env CPO itself already mandates that the result of the get_env call satisfies queryable, so the additional check in the receiver concept for this seems redundant.

Can we simplify the receiver concept to just check that get_env(rcvr) is valid?

Note that #321 is also exploring whether we need to check get_env(rcvr) at all, since it has an unconstrained fallback overload that should match any receiver.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions