Also adds std::iter_common_reference_t and std::indirect_result_t.
Implements parts of:
- P0896R4 The One Ranges Proposal
Differential D101277
[libcxx][iterator] adds `indirectly_[regular_]unary_invocable` and `projected` ldionne on Apr 25 2021, 10:17 PM. Authored by
Details
Also adds std::iter_common_reference_t and std::indirect_result_t. Implements parts of:
Diff Detail
Event Timeline
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.
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.
|