[libcxx-commits] [PATCH] D102037: [libcxx][views] Add drop_view.

Tim Song via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 22 13:27:52 PDT 2021


tcanens added inline comments.


================
Comment at: libcxx/include/__ranges/drop_view.h:106
+
+      auto __tmp = ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
+      if constexpr (_UseCache)
----------------
For the random-access-and-sized case, `begin` should not call `ranges::next` - that can be linear for sized-but-not-sized-sentinel ranges. It should just return `ranges::begin(__base_) + std::min(__count_, ranges::distance(__base_))`. Ditto below.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102037/new/

https://reviews.llvm.org/D102037



More information about the libcxx-commits mailing list