diff --git a/src/OpenMesh/Core/Mesh/SmartRange.hh b/src/OpenMesh/Core/Mesh/SmartRange.hh index 8b40e6e2..07299d48 100644 --- a/src/OpenMesh/Core/Mesh/SmartRange.hh +++ b/src/OpenMesh/Core/Mesh/SmartRange.hh @@ -116,6 +116,26 @@ struct SmartRangeT return (1.0 / n_elements) * sum; } + template + auto any_of(Functor&& f) -> bool + { + auto range = static_cast(this); + for (auto e : *range) + if (f(e)) + return true; + return false; + } + + template + auto all_of(Functor&& f) -> bool + { + auto range = static_cast(this); + for (auto e : *range) + if (!f(e)) + return false; + return true; + } + /** @brief Convert range to array. * * Converts the range of elements into an array of objects returned by functor \p f.