This is an archive of the discontinued LLVM Phabricator instance.

[libc++][ranges] Implement `views::drop`.
ClosedPublic

Authored by var-const on May 6 2022, 10:56 PM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rG8200e1253f6f: [libc++][ranges] Implement `views::drop`.
Summary

The view itself has been implemented previously -- this patch only adds
the ability to pipe it.

Also finishes the implementation of P1739 and
LWG3407.

Diff Detail

Event Timeline

var-const created this revision.May 6 2022, 10:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2022, 10:56 PM
var-const requested review of this revision.May 6 2022, 10:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2022, 10:56 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
var-const updated this revision to Diff 427817.May 6 2022, 10:58 PM

Tiny formatting fix.

var-const added inline comments.May 6 2022, 11:00 PM
libcxx/include/__ranges/drop_view.h
259

Not sure if this is worth making the actual implementation differ from the expressions in the return type and the noexcept clause. Calculating std::min twice seems wasteful (though I guess it should be easily optimized by the compiler?).

ldionne accepted this revision.May 9 2022, 7:59 AM
ldionne added a subscriber: ldionne.

LGTM

libcxx/include/__ranges/drop_view.h
158–160

To avoid those getting out of sync, perhaps we should instead make _StoreSize public and access it directly from here as subrange::_StoreSize?

This revision is now accepted and ready to land.May 9 2022, 7:59 AM
ldionne added inline comments.May 9 2022, 8:02 AM
libcxx/include/__ranges/drop_view.h
259

I think it makes sense to have it differ from the expression in the noexcept. Also, we shouldn't be computing ranges::distance(__rng) more than once.

var-const updated this revision to Diff 428196.May 9 2022, 2:02 PM
var-const marked an inline comment as done.

Make subrange::_StoreSize public; rebase.

var-const marked an inline comment as done.May 9 2022, 2:03 PM
var-const added inline comments.
libcxx/include/__ranges/drop_view.h
158–160

Done, thanks. I was thinking the same thing but was concerned about making this implementation detail public; on the other hand, with the "mangled" internal name it should be clear it shouldn't be used.

This revision was landed with ongoing or failed builds.May 10 2022, 9:31 AM
This revision was automatically updated to reflect the committed changes.
var-const marked an inline comment as done.May 10 2022, 9:33 AM

Merging -- the AIX failure with atomics looks unrelated.