[libcxx-commits] [PATCH] D102434: [libcxx][ranges] adds concept `sized_range` and cleans up `ranges::size`

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 13 21:12:42 PDT 2021

cjdb marked 3 inline comments as done.
cjdb added inline comments.

Comment at: libcxx/test/std/ranges/range.req/range.sized/sized_range.compile.pass.cpp:23
+static_assert(stdr::sized_range<int (&)[5]>);
+static_assert(!stdr::sized_range<int (&)[]>);
Quuxplusone wrote:
> cjdb wrote:
> > zoecarver wrote:
> > > Rvalue array?
> > That's `int[5]`.
> I assume Zoe was asking for xvalue (rvalue-reference) to array: `int (&&)[5]` and `int (&&)[]`.
This test checks that an lvalue array is a sized range and that an rvalue array is too. I'm not sure what adding a test to check an rvalue reference to an array is going to add overall that `int[5]` doesn't already do.

Comment at: libcxx/test/std/strings/string.view/range_concept_conformance.compile.pass.cpp:31
 static_assert(stdr::random_access_range<std::string_view const>);
 static_assert(!stdr::view<std::string_view const>);
+static_assert(stdr::sized_range<std::string_view const>);
Quuxplusone wrote:
> Unrelated to this PR, but it strikes me as odd that `string_view` is //not// a `std::ranges::view`.
> Should you perhaps be asserting `stdr::view<std::string_view&>` instead?
That would be because we haven't enabled `string_view` as a view yet.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list