This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Refactor the test for join_view's default constructor
ClosedPublic

Authored by ldionne on Jan 4 2022, 11:46 AM.

Details

Summary

In particular, this removes the need for adding a ad-hoc operator==
to forward_iterator.

Diff Detail

Event Timeline

ldionne requested review of this revision.Jan 4 2022, 11:46 AM
ldionne created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 4 2022, 11:46 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Quuxplusone added a subscriber: Quuxplusone.

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

libcxx/test/std/ranges/range.adaptors/range.join.view/iterator/ctor.default.pass.cpp
30

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.

ldionne updated this revision to Diff 398603.Jan 10 2022, 6:02 AM
ldionne marked an inline comment as done.

Apply review comments.

libcxx/test/std/ranges/range.adaptors/range.join.view/iterator/ctor.default.pass.cpp
30

There's no distinction between JoinedView and JoinView, just my own inconsistency. Thanks for spotting. I'm also fine with renaming Iter to It, but I'll keep view instead of std::subrange in order to keep the test as minimal as possible.

ldionne accepted this revision as: Restricted Project.Jan 10 2022, 6:02 AM
This revision is now accepted and ready to land.Jan 10 2022, 6:02 AM
This revision was landed with ongoing or failed builds.Jan 10 2022, 6:02 AM
This revision was automatically updated to reflect the committed changes.