Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions stl/inc/iterator
Original file line number Diff line number Diff line change
Expand Up @@ -1305,9 +1305,10 @@ public:
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.
// Per N4901 [counted.iterator]/3, two counted_iterators x and y refer to elements of the same sequence iff
// for some integer n, next(x.base(), x.count() + n) and next(y.base(), y.count() + n)
// "refer to the same (possibly past-the-end) element".
// Iterator equality is a fair proxy for the vaguely-defined "refer to the same element".
if constexpr (forward_iterator<_Iter> && forward_iterator<_Other>) {
using _CIter = common_type_t<_Iter, _Other>;
using _CDiff = common_type_t<iter_difference_t<_Iter>, iter_difference_t<_Other>>;
Expand All @@ -1316,11 +1317,11 @@ public:
if (_Diff < 0) {
_STL_VERIFY(
static_cast<_CIter>(_Left._Current) == _RANGES next(static_cast<_CIter>(_Right.base()), -_Diff),
"counted_iterators from different ranges");
"counted_iterators are from different ranges");
} else {
_STL_VERIFY(
_RANGES next(static_cast<_CIter>(_Left._Current), _Diff) == static_cast<_CIter>(_Right.base()),
"counted_iterators from different ranges");
"counted_iterators are from different ranges");
}
}
}
Expand Down