ericniebler/stl2

After P0547R0, const-qualified iterator types are not Readable or Writable

Closed this issue · 3 comments

Readable requires Movable. const-qualified types are not Movable after P0547R0. Ouch.

Proposed Resolution

Accept the revised wording in P0547R1.

SUPERSEDED (...by incorporation into P0547R1)

Update section "Concept Readable" ([iterators.readable]) as follows (also includes part of the PR for #330):

template <class I>
concept bool Readable() {
- return Movable<I>() && DefaultConstructible<I>() &&
-   requires(const I& i) {
+ return requires {
    typename value_type_t<I>;
    typename reference_t<I>;
    typename rvalue_reference_t<I>;
-   { *i } -> Same<reference_t<I>>;
-   { ranges::iter_move(i) } -> Same<rvalue_reference_t<I>>;
  } &&
  CommonReference<reference_t<I>, value_type_t<I>&>() &&
  CommonReference<reference_t<I>, rvalue_reference_t<I>>() &&
  CommonReference<rvalue_reference_t<I>, const value_type_t<I>&>();
}

Update section "Concept Writable" ([iterators.writable]) as follows:

template <class Out, class T>
concept bool Writable() {
- return Movable<Out>() && DefaultConstructible<Out>() &&
-   requires(Out o, T&& t) {
+ return requires(Out& o, T&& t) {
    *o = std::forward<T>(t); // not required to be equality preserving
  };
}

@CaseyCarter for your review.

The requires expression in Readable no longer needs any parameters. (There's also something funky with the indentation, but the Editor can fix that.)

Fixed by P0547, LWG wants to see the paper again.