[libcxx-commits] [PATCH] D105816: [libc++] Implement views::all_t and ranges::viewable_range
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 12 09:18:28 PDT 2021
Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.
LGTM % comments.
================
Comment at: libcxx/test/std/ranges/range.adaptors/range.all/all_t.compile.pass.cpp:34-35
+// Otherwise, when T is a reference to a range, returns ref_view<T>
+ASSERT_SAME_TYPE(std::views::all_t<Range&>, std::ranges::ref_view<Range>);
+ASSERT_SAME_TYPE(std::views::all_t<Range const&>, std::ranges::ref_view<Range const>);
+
----------------
I'd test `BorrowableRange&` and `BorrowableRange const&` right here, as well.
================
Comment at: libcxx/test/std/ranges/range.req/range.refinements/viewable_range.compile.pass.cpp:108
+static_assert(std::ranges::range<T7&>);
+static_assert(!std::ranges::view<T7>);
+static_assert(!std::constructible_from<T7, T7&>);
----------------
`s/T7/T7&/` here
================
Comment at: libcxx/test/std/ranges/range.req/range.refinements/viewable_range.compile.pass.cpp:114
+
+// A type that satisfies (range=true, view=false, constructible_from=false, borrowed_range=false) can't be formed
+
----------------
```
struct T8 : test_range<cpp20_input_iterator> {
T8(T8 const&) = delete;
};
static_assert(std::ranges::range<T8>);
static_assert(!std::ranges::view<T8>);
static_assert(!std::constructible_from<T8, T8>);
static_assert(!std::ranges::borrowed_range<T8>);
static_assert(!std::ranges::viewable_range<T8>);
```
================
Comment at: libcxx/test/std/ranges/range.req/range.refinements/viewable_range.compile.pass.cpp:119
+static_assert(!std::ranges::viewable_range<int>);
+static_assert(!std::ranges::viewable_range<int (*)(char)>);
----------------
Maybe test `int[]` and `int[10]` as well?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105816/new/
https://reviews.llvm.org/D105816
More information about the libcxx-commits
mailing list