[libcxx-commits] [libcxx] [libc++] optimization on ranges::drop_view::begin (#72883) (PR #72929)

Hewill Kang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 21 18:53:23 PST 2023


================
@@ -104,7 +108,8 @@ namespace ranges {
     constexpr auto begin() const
       requires random_access_range<const _View> && sized_range<const _View>
     {
-      return ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
+      range_difference_t<_View> __dist = ranges::distance(__base_);
----------------
hewillk wrote:

```suggestion
      const auto __dist = ranges::distance(__base_);
```

https://github.com/llvm/llvm-project/pull/72929


More information about the libcxx-commits mailing list