[libcxx-commits] [PATCH] D118164: [libc++] [ranges] ref_view and empty_view are borrowed ranges. Normalize borrowed_range tests.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 25 12:19:17 PST 2022
ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.
Instead of using `single_view` and `empty_view` to mean `NonBorrowedRange` and `BorrowedRange`, I would rather retain such "archetypes" in `test_range.h` and use them in our tests. That way, our tests won't be wrong if our implementation is, and their names is more telling than `single_view` and `empty_view`, which say nothing about their borrowable-ness. This would even be acceptable, but while we're at it why not define them self-standing:
using NonBorrowedRange = std::ranges::single_view;
using BorrowedRange = std::ranges::empty_view;
At least that documents what we're testing for free.
================
Comment at: libcxx/test/std/ranges/range.adaptors/range.all/range.ref.view/borrowing.compile.pass.cpp:18-19
-#include "test_iterators.h"
-
-namespace ranges = std::ranges;
-
-static_assert(ranges::borrowed_range<ranges::subrange<int*>>);
-static_assert(ranges::borrowed_range<ranges::subrange<int*, int const*>>);
-static_assert(ranges::borrowed_range<ranges::subrange<int*, sentinel_wrapper<int*>, ranges::subrange_kind::unsized>>);
+static_assert( std::ranges::borrowed_range<std::ranges::ref_view<std::ranges::single_view<int>>>);
+static_assert( std::ranges::borrowed_range<std::ranges::ref_view<std::ranges::empty_view<int>>>);
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118164/new/
https://reviews.llvm.org/D118164
More information about the libcxx-commits
mailing list