summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-02-15 20:45:10 (GMT)
committerBrad King <brad.king@kitware.com>2019-02-21 13:24:26 (GMT)
commitda4773e8b8100f27ee117005c81e81574f5a9868 (patch)
tree4feb6db41d82caa49a5237cafdcde3def14fe6be
parent17a367e77f373e2781e80e80aaa32644754e6f88 (diff)
downloadCMake-da4773e8b8100f27ee117005c81e81574f5a9868.zip
CMake-da4773e8b8100f27ee117005c81e81574f5a9868.tar.gz
CMake-da4773e8b8100f27ee117005c81e81574f5a9868.tar.bz2
cmRange: Add functions all_of, any_of, none_of
-rw-r--r--Source/cmRange.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmRange.h b/Source/cmRange.h
index a84ccec..b6d161e 100644
--- a/Source/cmRange.h
+++ b/Source/cmRange.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <algorithm>
+#include <functional>
#include <iterator>
template <typename Iter>
@@ -55,6 +56,24 @@ public:
return std::move(*this);
}
+ template <typename UnaryPredicate>
+ bool all_of(UnaryPredicate p) const
+ {
+ return std::all_of(this->Begin, this->End, std::ref(p));
+ }
+
+ template <typename UnaryPredicate>
+ bool any_of(UnaryPredicate p) const
+ {
+ return std::any_of(this->Begin, this->End, std::ref(p));
+ }
+
+ template <typename UnaryPredicate>
+ bool none_of(UnaryPredicate p) const
+ {
+ return std::none_of(this->Begin, this->End, std::ref(p));
+ }
+
private:
Iter Begin;
Iter End;