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