[libcxx-commits] [PATCH] D141699: [libc++][ranges] Implement P2474R2(`views::repeat`).

Yurong via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 5 03:19:58 PST 2023


yronglin added inline comments.


================
Comment at: libcxx/include/__ranges/repeat_view.h:111
+      : __value_(std::in_place, std::ranges::__repeat_view_make_from_tuple<_Tp>(std::move(__value_args))),
+        __bound_(std::ranges::__repeat_view_make_from_tuple<_Bound>(std::move(__bound_args))) {}
+
----------------
philnik wrote:
> Why not simply use `std::make_from_tuple`?
`__repeat_view_make_from_tuple` still is a workaround for older version clang (https://godbolt.org/z/dreT87G4f). as far as I know, `std::make_from_tuple` initializing aggregates from a parenthesized list of values( https://github.com/llvm/llvm-project/blob/c0b4ca107a3b605f810bd60642907e6a77f7c6d3/libcxx/include/tuple#L1835 ), but this code requires P0960


================
Comment at: libcxx/include/__ranges/repeat_view.h:138
+// [range.repeat.iterator]
+template <copy_constructible _Tp, semiregular _Bound>
+  requires(is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> &&
----------------
philnik wrote:
> Please add a regression test!
> Please add a regression test!

I think here is `copy_constructible`, not `move_constructible` ?
```
template<copy_constructible W, semiregular Bound = unreachable_sentinel_t>
    requires is-integer-like<Bound> || same_as<Bound, unreachable_sentinel_t>
  class repeat_view<W, Bound>::iterator {
  private:
  ......
  };
```

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2474r2.html#wording-range.repeat.iterator


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141699



More information about the libcxx-commits mailing list