[libcxx-commits] [PATCH] D111231: [libc++] [test] Change a lot of free begin/end pairs to members. NFCI.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 6 07:29:12 PDT 2021


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

If you have a `begin() const` member, you don't need a `begin()` member unless you want it to do something different (e.g. have a different return type). So in general, //view// types don't need `begin()` non-const members.

Also, static_assert some things about the types in "types.h", so that we don't accidentally break those properties under refactoring.

(This came out of my attempts to make a "test_iterators.h" PR along the lines of @jloser's `sized_sentinel<It>`. It turned out that in many of the places we'll want to use `sized_sentinel<It>`, we currently have to use twice as much of it as necessary, because of all these places that use two free functions when one member would suffice. I believe I've been careful //not// to change any of the places that were actually //trying to test// our behavior on free `begin`/`end`, e.g. in the tests for `std::ranges::begin`.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111231

Files:
  libcxx/test/libcxx/ranges/range.utility.helpers/simple_view.compile.pass.cpp
  libcxx/test/std/ranges/range.access/range.prim/data.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.all/all.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.common.view/borrowing.compile.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.common.view/ctad.compile.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.common.view/types.h
  libcxx/test/std/ranges/range.adaptors/range.drop/types.h
  libcxx/test/std/ranges/range.adaptors/range.join.view/types.h
  libcxx/test/std/ranges/range.adaptors/range.take/begin.pass.cpp
  libcxx/test/std/ranges/range.adaptors/range.take/types.h
  libcxx/test/std/ranges/range.adaptors/range.transform/types.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111231.377540.patch
Type: text/x-patch
Size: 35492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211006/b142270a/attachment-0001.bin>


More information about the libcxx-commits mailing list