Also adds std::iter_common_reference_t and std::indirect_result_t.
Implements parts of:
- P0896R4 The One Ranges Proposal
Paths
| Differential D101277
[libcxx][iterator] adds `indirectly_[regular_]unary_invocable` and `projected` ClosedPublic Authored by ldionne on Apr 25 2021, 10:17 PM.
Details
Summary Also adds std::iter_common_reference_t and std::indirect_result_t. Implements parts of:
Diff Detail
Unit TestsFailed Event Timeline
ldionne marked an inline comment as done. Comment ActionsRebase, add tests, also implement equivalence_relation and strict_weak_order
Comment Actions LGTM. Thanks. Only suggestion, does it make sense to add one or two tests where we are using this as a user would, instead of just checking the requirements are there? Maybe something like: template<std::input_iterator I, std::sentinel_for<I> S, std::indirectly_unary_invocable<I> Fun> constexpr auto myForEach(I first, S last, Fun f) const { for (; first != last; ++first) { std::invoke(f, *first); } return {first, f}; } Or you could even test std::projected by projecting f. I suppose these will come when we implement algs, such as for_each, so maybe it doesn't make sense.
cjdb added inline comments. Comment Actions
Yeah, I think it makes sense. I did it somewhat differently though, by adding asserts for a few less artificial predicates like [](int i) { return i % 2 == 0; } and simple things like that.
ldionne marked an inline comment as done. This revision is now accepted and ready to land.May 28 2021, 7:08 AM This revision was landed with ongoing or failed builds.May 28 2021, 7:09 AM Closed by commit rG58b29a4efc22: [libc++] Add all indirect callable concepts and projected (authored by ldionne). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 348522 libcxx/include/CMakeLists.txt
libcxx/include/__iterator/concepts.h
libcxx/include/__iterator/indirect_concepts.h
libcxx/include/__iterator/projected.h
libcxx/include/iterator
libcxx/test/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_binary_predicate.compile.pass.cpp
libcxx/test/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_equivalence_relation.compile.pass.cpp
libcxx/test/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_result_t.compile.pass.cpp
libcxx/test/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_strict_weak_order.compile.pass.cpp
libcxx/test/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_unary_predicate.compile.pass.cpp
libcxx/test/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirectly_regular_unary_invocable.compile.pass.cpp
libcxx/test/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirectly_unary_invocable.compile.pass.cpp
libcxx/test/std/iterators/iterator.requirements/indirectcallable/projected/projected.compile.pass.cpp
libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.readable/iter_common_reference_t.compile.pass.cpp
libcxx/test/support/indirectly_readable.h
|
This is basically copy-pasted from equivalence_relation because both are the same modulo semantic requirements.