[libcxx-commits] [PATCH] D118164: [libc++] [ranges] ref_view and empty_view are borrowed ranges. Normalize borrowed_range tests.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 25 10:03:06 PST 2022


Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, Mordante, philnik, var-const.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

As reported in D116303 <https://reviews.llvm.org/D116303>. I've taken the liberty of simplifying all the existing borrowed_range tests to

- be named `borrowing.compile.pass.cpp`
- use simple library types, specifically `empty_view` (is borrowed) and `single_view` (is not borrowed), wherever possible (the only place this isn't possible AFAICT is in `common_view`, where I left a comment)
- move `range.ref.view` into its own subdirectory, but not dig into that rabbit hole otherwise
- consistently test for adherence to `concept borrowed_range`, rather than `constexpr bool enable_borrowed_range` — the latter is equally technically correct, but the former is shorter, and also more like what the library user will actually do in practice. No user should ever query `enable_borrowed_range` directly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118164

Files:
  libcxx/include/__ranges/empty_view.h
  libcxx/include/__ranges/ref_view.h
  libcxx/test/std/ranges/range.adaptors/range.all/range.owning.view/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.all/range.ref.view/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.all/range.ref.view/range.ref.view.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.common.view/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.empty/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.ref.view.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.reverse/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.take/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.factories/range.iota.view/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.factories/range.single.view/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.utility/range.subrange/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.utility/range.subrange/enable_borrowed_range.compile.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118164.402954.patch
Type: text/x-patch
Size: 12921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220125/c03f5265/attachment-0001.bin>


More information about the libcxx-commits mailing list