This is an archive of the discontinued LLVM Phabricator instance.

[libc++][ranges] implement `std::ranges::drop_while_view`
ClosedPublic

Authored by huixie90 on Oct 7 2022, 10:11 AM.

Diff Detail

Event Timeline

huixie90 created this revision.Oct 7 2022, 10:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2022, 10:11 AM
huixie90 requested review of this revision.Oct 7 2022, 10:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2022, 10:11 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Oct 14 2022, 9:19 AM
ldionne added inline comments.
libcxx/include/__ranges/drop_while_view.h
69

Maybe that's a bit better for a user? Per live review, we think that's the only situation that can lead us to this assertion failing.

Also, this is non-blocking because extremely pedantic, but it might be nice to add an assert.<xxxxxx>.pass.cpp test to check that behavior. You can take inspiration of other tests like libcxx/test/libcxx/strings/basic.string/string.access/assert.back.pass.cpp.

libcxx/test/std/ranges/range.adaptors/range.drop.while/ctor.default.pass.cpp
18

Same below.

20–23

Maybe you could initialize i to a non-zero value just to rule out the fact that we're accessing zeroed-by-chance memory that would be uninitialized below?

libcxx/test/std/ranges/range.adaptors/range.drop.while/general.pass.cpp
21

Maybe that's closer to what a user would actually write?

This revision is now accepted and ready to land.Oct 14 2022, 9:19 AM
huixie90 updated this revision to Diff 468169.Oct 17 2022, 5:10 AM
huixie90 marked 4 inline comments as done.

addressed comments