[libcxx-commits] [PATCH] D116614: [libc++] Refactor the test for join_view's default constructor

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 6 11:19:41 PST 2022


Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.

Wow, that old code was crazy complicated for the fact that this is all it's doing. Nice cleanup.



================
Comment at: libcxx/test/std/ranges/range.adaptors/range.join.view/iterator/ctor.default.pass.cpp:30
+constexpr void test_default_constructible() {
+  using JoinedView = std::ranges::join_view<view<Iter>>;
+  using JoinIterator = std::ranges::iterator_t<JoinedView>;
----------------
Rename to `JoinView`? (I don't understand whatever distinction you're making between `JoinX` and `JoinedX`.)
Throughout, I'd rename `Iter` -> `It`, and in fact I'd get rid of the custom `view` helper class in favor of `std::subrange`:
```
template <class It>
constexpr void test_default_constructible() {
  using View = std::subrange<It, sentinel_wrapper<It>>;
  using JoinIterator = std::ranges::iterator_t<std::ranges::join_view<View>>;
  static_assert(std::is_default_constructible_v<JoinIterator>);
  JoinIterator it; (void)it;
}
```
Likewise below.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116614/new/

https://reviews.llvm.org/D116614



More information about the libcxx-commits mailing list