This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
move_iterator should provide iterator_category only when it models
forward_iteratorSection: 24.5.4.2 [move.iterator] Status: New Submitter: Hewill Kang Opened: 2024-07-12 Last modified: 2024-08-31
Priority: 3
View other active issues in [move.iterator].
View all other issues in [move.iterator].
View all issues with New status.
Discussion:
Following up LWG 4116(i), when the underlying iterator does not satisfy forward_iterator,
move_iterator::operator++(int) will return void, which fails to meet the C++17 iterator
requirements, which should not provide iterator_category.
[2024-08-02; Reflector poll]
Set priority to 3 after reflector poll.
"NAD, would be a major breaking change to something present since C++11."
"We're knowingly breaking the rules here for backwards compatibility. Should have a note here indicating that the rule is broken for good reason, and that you should do as the Standard says and not as the Standard does."
Proposed resolution:
This wording is relative to N4986.
Modify 24.5.4.2 [move.iterator] as indicated:
[Drafting note:
Iteratorthat modelsforward_iteratorimplies thatiterator_traits<Iterator>::iterator_categoryis always valid as it satisfies the exposition-only conceptcpp17-iterator.]
-2- The member typedef-name
iterator_categoryis defined if and only ifthe qualified-iditerator_traits<Iterator>::iterator_categoryis valid and denotes a typeIteratormodelsforward_iterator. In that case,iterator_categorydenotes
(2.1) —
random_access_iterator_tagif the typeiterator_traits<Iterator>::iterator_categorymodelsderived_from<random_access_iterator_tag>, and(2.2) —
iterator_traits<Iterator>::iterator_categoryotherwise.