[libc++] Implement ranges::starts_with
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks pretty good already. Please make sure the CI is green.
libcxx/include/__algorithm/ranges_starts_with.h | ||
---|---|---|
12 | You have to #include <__config>. | |
50 | Please update the nodiscard_extension tests! | |
58 | I think we should just forward this for ranges::equal (for random access ranges) or ranges::mismatch (otherwise) to grab any optimizations that are done there. | |
libcxx/test/std/algorithms/alg.nonmodifying/alg.starts_with/ranges.starts_with.pass.cpp | ||
13 | This isn't a relevant flag anymore. | |
33 | Looks like clang-format does weird things again. Please update the formatting. | |
194–202 | This can be simplified now. See ranges.copy.pass.cpp for an example. | |
204–224 | We have a few robust_against_footests for this and other things. Please make sure you update them. | |
233 | Newline! |
libcxx/include/__algorithm/ranges_starts_with.h | ||
---|---|---|
58 | yes, I used ranges::mismatch directly before but the comparators and projections will be copied, which fail ranges_robust_against_copying_comparators.pass.cpp and ranges_robust_against_copying_projections.pass.cpp |
libcxx/include/__algorithm/ranges_starts_with.h | ||
---|---|---|
58 | You can call the actual implementation instead of the public interface to avoid that. |
libcxx/include/__algorithm/ranges_starts_with.h | ||
---|---|---|
12 | I see. Yes, according to the build error log, I need to include more header files. WIP |
LGTM % comments with green CI.
libcxx/include/__algorithm/ranges_starts_with.h | ||
---|---|---|
13 | ||
53 | Would you be interested in optimizing random access iterators? If not, I can also do that in a follow-up patch. | |
libcxx/test/std/algorithms/alg.nonmodifying/alg.starts_with/ranges.starts_with.pass.cpp | ||
33 | You can enable and disable clang-format with // clang-format off/on. | |
66 | Please use two spaces per indentation level. | |
218–225 | ||
254–255 |
You have to #include <__config>.