[libcxx-commits] [PATCH] D141699: [In Progress][libc++][ranges] Implement P2474R2(`views::repeat`).
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jan 15 10:05:30 PST 2023
philnik added inline comments.
================
Comment at: libcxx/include/__ranges/repeat_view.h:43
+private:
+ struct __iterator;
+
----------------
yronglin wrote:
> philnik wrote:
> > You can't make this a member of `repeat_view` because it makes specializing traits impossible. Instead, make it a class inside `namespace std` and add an alias here. You can look at `istream_view` for an example of this.
> I have updated the patch, and many thanks for your help! But it's looks like a little bit not very close to the words.
> ```
> namespace std::ranges {
> template<copy_constructible W, semiregular Bound = unreachable_sentinel_t>
> requires (is_object_v<W> && same_as<W, remove_cv_t<W>>
> && (is-integer-like<Bound> || same_as<Bound, unreachable_sentinel_t>))
> class repeat_view : public view_interface<repeat_view<W, Bound>> {
> private:
> // [range.repeat.iterator], class range_view::iterator
> struct iterator;
>
> copyable-box<W> value_ = W(); // exposition only, see [range.copy.wrap]
> Bound bound_ = Bound(); // exposition only
>
> public:
> repeat_view() requires default_initializable<W> = default;
>
> constexpr explicit repeat_view(const W & value, Bound bound = Bound());
> constexpr explicit repeat_view(W && value, Bound bound = Bound());
> template<class... WArgs, class... BoundArgs>
> requires constructible_from<W, WArgs...>
> && constructible_from<Bound, BoundArgs...>
> constexpr explicit repeat_view(piecewise_construct_t,
> tuple<WArgs...> value_args, tuple<BoundArgs...> bound_args = tuple<>{});
>
> constexpr iterator begin() const;
> constexpr iterator end() const requires (!same_as<Bound, unreachable_sentinel_t>);
> constexpr unreachable_sentinel_t end() const noexcept;
>
> constexpr auto size() const requires (!same_as<Bound, unreachable_sentinel_t>);
> };
>
> template<class W, class Bound>
> repeat_view(W, Bound) -> repeat_view<W, Bound>;
> }
>
> ```
Yes, but in this case there is a technical reason to change this.
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