cplusplus / sender-receiver

Issues list for P2300
Apache License 2.0
19 stars 3 forks source link

scheduler semantic requirements imply presence of 'swap' member function, but concept does not require it #270

Open lewissbaker opened 3 months ago

lewissbaker commented 3 months ago

The current wording for scheduler concept in P2300R10 has the following concept:

  template<class Sch>
    concept scheduler =
      derived_from<typename remove_cvref_t<Sch>::scheduler_concept, scheduler_t> &&
      queryable<Sch> &&
      requires(Sch&& sch) {
        { schedule(std::forward<Sch>(sch)) } -> sender;
        { auto(get_completion_scheduler<set_value_t>(
            get_env(schedule(std::forward<Sch>(sch))))) }
              -> same_as<remove_cvref_t<Sch>>;
      } &&
      equality_comparable<remove_cvref_t<Sch>> &&
      copy_constructible<remove_cvref_t<Sch>>;

And then in p3, the following sentence:

None of a scheduler's copy constructor, ..., or swap member functions shall exit via an exception.

However, the concept does not actually require that the scheduler has a swap member function, or that it is swappable.

Should the scheduler concept require swappable<Sch>?

Also, the concept does not require move-assignability of schedulers, so the default swap() implementation is not going to work for types that minimally implement this concept.