Created on 2021-09-26.00:00:00 last changed 38 months ago
Proposed resolution:
This wording is relative to N4892.
Modify [reverse.iter.cons] as indicated:
template<class U> constexpr reverse_iterator& operator=(const reverse_iterator<U>& u);-5- Constraints: is_same_v<U, Iterator> is false
-6- Effects: Assigns u.current to current. -7- Returns: *this., const U& models convertible_to<Iterator>,and assignable_from<Iterator&, const U&> is modeled.
Modify [move.iter.cons] as indicated:
[Drafting note: As drive-by fix a missing "Returns: *this" has been added as well.]
template<class U> constexpr move_iterator& operator=(const move_iterator<U>& u);-5- Constraints: is_same_v<U, Iterator> is false
-6- Effects: Assigns u.current to current. -?- Returns: *this., const U& models convertible_to<Iterator>,and assignable_from<Iterator&, const U&> is modeled.
[ Tomasz Kamiński commented ]
The move_iterator
/reverse_iterator
were present before C++20,
and this change restores their compatibility with C++17 code,
where only assignment was required.
They are materially different from adapters introduced with C++20,
and I believe we should put more weight into backward compatibility
than consistency with newer iterator wrappers.
[ Tim Song commented: ]
This was
intentional,
but I think we missed the fact that counted_iterator
did something
else already. These should probably be made consistent one way or another.
[ 2021-10-14; Reflector poll ]
Set priority to 3 after reflector poll.
In order to remove the incorrect bi-convertibility of reverse_iterator<int*> and reverse_iterator<const int*>, LWG 3435 adds two constraints to reverse_iterator's converting assignment, namely convertible_to<const U&, Iterator> and assignable_from<Iterator&, const U&>, but since this function only assigns u.current to current, there is no need to require convertible_to<const U&, Iterator> — the latter is sufficient.
We should remove this constraint and be consistent with the move_sentinel and counted_iterator' converting assignment.History | |||
---|---|---|---|
Date | User | Action | Args |
2021-10-14 11:35:36 | admin | set | messages: + msg12159 |
2021-10-14 11:35:36 | admin | set | messages: + msg12158 |
2021-10-14 11:35:36 | admin | set | messages: + msg12157 |
2021-10-02 15:36:25 | admin | set | messages: + msg12081 |
2021-09-26 00:00:00 | admin | create |