diff --git a/TinySTL/Algorithm.h b/TinySTL/Algorithm.h index 08104b4..00859a6 100644 --- a/TinySTL/Algorithm.h +++ b/TinySTL/Algorithm.h @@ -187,6 +187,16 @@ namespace TinySTL{ } return true; } + //********** [any_of] ************************* + //********* [Algorithm Complexity: O(N)] **************** + template + bool any_of(InputIterator first, InputIterator last, UnaryPredicate pred){ + for (; first != last; ++first){ + if (pred(*first)) + return true; + } + return false; + } }