mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 22:37:30 +08:00
cmRange: Add functions all_of, any_of, none_of
This commit is contained in:

committed by
Brad King

parent
17a367e77f
commit
da4773e8b8
@@ -6,6 +6,7 @@
|
|||||||
#include "cmConfigure.h" // IWYU pragma: keep
|
#include "cmConfigure.h" // IWYU pragma: keep
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
template <typename Iter>
|
template <typename Iter>
|
||||||
@@ -55,6 +56,24 @@ public:
|
|||||||
return std::move(*this);
|
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:
|
private:
|
||||||
Iter Begin;
|
Iter Begin;
|
||||||
Iter End;
|
Iter End;
|
||||||
|
Reference in New Issue
Block a user