[libcxx-commits] [PATCH] D125156: [libc++][ranges] Implement `views::drop`.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 9 08:02:47 PDT 2022


ldionne added inline comments.


================
Comment at: libcxx/include/__ranges/drop_view.h:259
+    {
+      auto clamped = std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n));
+      return          _RawRange(
----------------
var-const wrote:
> Not sure if this is worth making the actual implementation differ from the expressions in the return type and the `noexcept` clause. Calculating `std::min` twice seems wasteful (though I guess it should be easily optimized by the compiler?).
I think it makes sense to have it differ from the expression in the `noexcept`. Also, we shouldn't be computing `ranges::distance(__rng)` more than once.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125156



More information about the libcxx-commits mailing list