Skip to content

Commit e38d521

Browse files
burblebeetkoeppe
authored andcommitted
LWG3717 common_view::end should improve random_access_range case
Partially fixes NB US 109 (C++23 CD).
1 parent 871cf97 commit e38d521

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/ranges.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8427,14 +8427,14 @@
84278427

84288428
constexpr auto end() {
84298429
if constexpr (@\libconcept{random_access_range}@<V> && @\libconcept{sized_range}@<V>)
8430-
return ranges::begin(@\exposid{base_}@) + ranges::size(@\exposid{base_}@);
8430+
return ranges::begin(@\exposid{base_}@) + ranges::distance(@\exposid{base_}@);
84318431
else
84328432
return common_iterator<iterator_t<V>, sentinel_t<V>>(ranges::end(@\exposid{base_}@));
84338433
}
84348434

84358435
constexpr auto end() const requires @\libconcept{range}@<const V> {
84368436
if constexpr (@\libconcept{random_access_range}@<const V> && @\libconcept{sized_range}@<const V>)
8437-
return ranges::begin(@\exposid{base_}@) + ranges::size(@\exposid{base_}@);
8437+
return ranges::begin(@\exposid{base_}@) + ranges::distance(@\exposid{base_}@);
84388438
else
84398439
return common_iterator<iterator_t<const V>, sentinel_t<const V>>(ranges::end(@\exposid{base_}@));
84408440
}

0 commit comments

Comments
 (0)