Skip to content

LWG-3543 Definition of when counted_iterators refer to the same sequence isn't quite right #2184

@StephanTLavavej

Description

@StephanTLavavej

LWG-3543 Definition of when counted_iterators refer to the same sequence isn't quite right

In #1965, @frederick-vs-ja categorized this as:

Implemented at first, only comments should be updated.
_Same_sequence performs as least increments as possible, which is still OK for current wording

The comment is:

STL/stl/inc/iterator

Lines 1278 to 1284 in 6fe2eae

template <common_with<_Iter> _Other>
friend constexpr void _Same_sequence(
const counted_iterator& _Left, const counted_iterator<_Other>& _Right) noexcept {
// Per N4861 [counted.iterator]/2, two counted_iterators x and y refer to elements of the same sequence iff
// next(x.base(), x.count()) and next(y.base(), y.count()) "refer to the same element." Iterator equality is a
// fair proxy for this condition.
if constexpr (forward_iterator<_Iter> && forward_iterator<_Other>) {

I agree that the comment should be updated to cite WG21-N4892's new wording. (It appears that this isn't a case where the comment should be removed entirely.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationRelated to documentation or commentsfixedSomething works now, yay!rangesC++20/23 ranges

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions