Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
casavaca committed Dec 21, 2023
1 parent e2ec7a4 commit 9bdf7bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libcxx/include/__ranges/drop_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ class drop_view : public view_interface<drop_view<_View>> {
_LIBCPP_HIDE_FROM_ABI constexpr auto begin()
requires(!(__simple_view<_View> && random_access_range<const _View> && sized_range<const _View>))
{
if constexpr (random_access_range<_View> && sized_range<_View>) {
const auto __dist = std::min(ranges::distance(__base_), __count_);
return ranges::begin(__base_) + __dist;
}
if constexpr (_UseCache)
if (__cached_begin_.__has_value())
return *__cached_begin_;
Expand All @@ -103,7 +107,8 @@ class drop_view : public view_interface<drop_view<_View>> {
_LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
requires random_access_range<const _View> && sized_range<const _View>
{
return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
const auto __dist = std::min(ranges::distance(__base_), __count_);
return ranges::begin(__base_) + __dist;
}

_LIBCPP_HIDE_FROM_ABI constexpr auto end()
Expand Down

0 comments on commit 9bdf7bb

Please sign in to comment.