Page MenuHomePhabricator

[libc++] Implement ranges::filter_view
Needs ReviewPublic

Authored by ldionne on Sep 1 2021, 1:36 PM.

Details

Reviewers
None
Group Reviewers
Restricted Project

Diff Detail

Event Timeline

ldionne created this revision.Sep 1 2021, 1:36 PM
ldionne requested review of this revision.Sep 1 2021, 1:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 1:36 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Note that this is still missing tests for the iterator and the sentinel, but I wanted to put it up for review to get some initial feedback. I'll finish the tests for iterator and sentinel when I get some more uninterrupted "free time".

ldionne updated this revision to Diff 370134.Sep 1 2021, 6:52 PM

Poke CI overnight

Quuxplusone added inline comments.
libcxx/include/__ranges/filter_view.h
124–125

These conditions smell backwards. Shouldn't it be _Cat satisfies derived_from<foo_tag>, i.e. derived_from<_Cat, foo_tag>?
But actually I would suggest testing the full concept: _If<bidirectional_iterator<_Cat>, bidirectional_iterator_tag, .... Because (sadly) it's perfectly possible in C++20 to have an iterator advertising bidirectional_iterator_tag that itself is only a forward_iterator. The forward_iterator concept does not have any "penalty for overpromising."

Both the bug(?) and the sad scenario could use a test case.