Skip to content

Commit 7583485

Browse files
burblebeetkoeppe
authored andcommitted
LWG3737 take_view::sentinel should provide operator-
Partially fixes NB US 109 (C++23 CD).
1 parent e38d521 commit 7583485

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

source/ranges.tex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,6 +5746,10 @@
57465746
auto sz = range_difference_t<V>(size());
57475747
return counted_iterator(ranges::begin(@\exposid{base_}@), sz);
57485748
}
5749+
} else if constexpr (@\libconcept{sized_sentinel_for}@<sentinel_t<V>, iterator_t<V>>) {
5750+
auto it = ranges::begin(@\exposid{base_}@);
5751+
auto sz = std::min(@\exposid{count_}@, ranges::end(@\exposid{base_}@) - it);
5752+
return counted_iterator(std::move(it), sz);
57495753
} else {
57505754
return counted_iterator(ranges::begin(@\exposid{base_}@), @\exposid{count_}@);
57515755
}
@@ -5759,6 +5763,10 @@
57595763
auto sz = range_difference_t<const V>(size());
57605764
return counted_iterator(ranges::begin(@\exposid{base_}@), sz);
57615765
}
5766+
} else if constexpr (@\libconcept{sized_sentinel_for}@<sentinel_t<const V>, iterator_t<const V>>) {
5767+
auto it = ranges::begin(@\exposid{base_}@);
5768+
auto sz = std::min(@\exposid{count_}@, ranges::end(@\exposid{base_}@) - it);
5769+
return counted_iterator(std::move(it), sz);
57625770
} else {
57635771
return counted_iterator(ranges::begin(@\exposid{base_}@), @\exposid{count_}@);
57645772
}
@@ -5770,6 +5778,8 @@
57705778
return ranges::begin(@\exposid{base_}@) + range_difference_t<V>(size());
57715779
else
57725780
return default_sentinel;
5781+
} else if constexpr (@\libconcept{sized_sentinel_for}@<sentinel_t<V>, iterator_t<V>>) {
5782+
return default_sentinel;
57735783
} else {
57745784
return @\exposid{sentinel}@<false>{ranges::end(@\exposid{base_}@)};
57755785
}
@@ -5781,6 +5791,8 @@
57815791
return ranges::begin(@\exposid{base_}@) + range_difference_t<const V>(size());
57825792
else
57835793
return default_sentinel;
5794+
} else if constexpr (@\libconcept{sized_sentinel_for}@<sentinel_t<const V>, iterator_t<const V>>) {
5795+
return default_sentinel;
57845796
} else {
57855797
return @\exposid{sentinel}@<true>{ranges::end(@\exposid{base_}@)};
57865798
}

0 commit comments

Comments
 (0)