--- a/src/functional.h Mon Jul 19 23:41:52 2021 +0300 +++ b/src/functional.h Tue Jul 20 01:22:01 2021 +0300 @@ -157,3 +157,29 @@ return result; } } + +template<typename T, typename Fn> +bool any(T&& container, Fn&& f) +{ + for (auto&& x : container) + { + if (f(x)) + { + return true; + } + } + return false; +} + +template<typename T, typename Fn> +bool all(T&& container, Fn&& f) +{ + for (auto&& x : container) + { + if (not f(x)) + { + return false; + } + } + return true; +}