Introduce a range version of std::any_of, and use it in SCEV
[oota-llvm.git] / include / llvm / ADT / STLExtras.h
index 1bd3b291e0ef3a3e1edd34959c8f5dc37a804378..3655a20d8831816352bf42acc7eb9ee5d231bfe4 100644 (file)
@@ -371,6 +371,14 @@ bool all_of(R &&Range, UnaryPredicate &&P) {
                      std::forward<UnaryPredicate>(P));
 }
 
+/// Provide wrappers to std::any_of which take ranges instead of having to pass
+/// begin/end explicitly.
+template <typename R, class UnaryPredicate>
+bool any_of(R &&Range, UnaryPredicate &&P) {
+  return std::any_of(Range.begin(), Range.end(),
+                     std::forward<UnaryPredicate>(P));
+}
+
 //===----------------------------------------------------------------------===//
 //     Extra additions to <memory>
 //===----------------------------------------------------------------------===//