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

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat May 8 12:10:46 PDT 2021


cjdb added inline comments.


================
Comment at: libcxx/include/__ranges/drop_view.h:41
+  template<view _View, bool = forward_range<_View>>
+  struct __cache_base {
+    iterator_t<_View> __cached_begin{};
----------------
`__cache_base` is a bit too general a name.


================
Comment at: libcxx/include/__ranges/drop_view.h:44
+    range_difference_t<_View> __count = 0;
+    iterator_t<_View> __cached_begin = ranges::begin(__base);
+
----------------
tcanens wrote:
> tcanens wrote:
> > There's no requirement that `ranges::begin` on a default-constructed view is even well-defined (see: `ref_view`).
> > 
> > Additionally, when a `drop_view` is copied, the cache must be invalidated in the copy.
> ...and when a `drop_view` is moved-from, the cache must be invalidated in the original.
@tcanens is this a non-propagating cache?


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