File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,10 @@ class drop_view : public view_interface<drop_view<_View>> {
90
90
_LIBCPP_HIDE_FROM_ABI constexpr auto begin ()
91
91
requires(!(__simple_view<_View> && random_access_range<const _View> && sized_range<const _View>))
92
92
{
93
+ if constexpr (random_access_range<_View> && sized_range<_View>) {
94
+ const auto __dist = std::min (ranges::distance (__base_), __count_);
95
+ return ranges::begin (__base_) + __dist;
96
+ }
93
97
if constexpr (_UseCache)
94
98
if (__cached_begin_.__has_value ())
95
99
return *__cached_begin_;
@@ -103,7 +107,8 @@ class drop_view : public view_interface<drop_view<_View>> {
103
107
_LIBCPP_HIDE_FROM_ABI constexpr auto begin () const
104
108
requires random_access_range<const _View> && sized_range<const _View>
105
109
{
106
- return ranges::next (ranges::begin (__base_), __count_, ranges::end (__base_));
110
+ const auto __dist = std::min (ranges::distance (__base_), __count_);
111
+ return ranges::begin (__base_) + __dist;
107
112
}
108
113
109
114
_LIBCPP_HIDE_FROM_ABI constexpr auto end ()
You can’t perform that action at this time.
0 commit comments