[PATCH] D22951: [ADT] Add filter_iterator for filtering elements

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 14:36:27 PDT 2016


dblaikie accepted this revision.
This revision is now accepted and ready to land.

================
Comment at: include/llvm/ADT/STLExtras.h:255
@@ +254,3 @@
+///   int A[] = { 1, 2, 3, 4 };
+///   auto R = make_filter_range(A, [](int A) { return A % 2 == 1; });
+///   // R contains { 1, 3 }.
----------------
Might be worth renaming one of the 'A's to make this a bit easier to read.

================
Comment at: include/llvm/ADT/STLExtras.h:321
@@ +320,3 @@
+iterator_range<filter_iterator<detail::IterOfRange<RangeT>, PredicateT>>
+make_filter_range(RangeT &&Range, PredicateT Pred) {
+  using FilterIteratorT =
----------------
I'd suggest renaming this to simply 'filter'. But if you'd rather defer that to some broader discussion, that's OK too.


https://reviews.llvm.org/D22951





More information about the llvm-commits mailing list