完成any_of

This commit is contained in:
邹晓航
2014-10-17 17:26:59 +08:00
parent 4e3993404c
commit 2c042b6d51

View File

@@ -187,6 +187,16 @@ namespace TinySTL{
}
return true;
}
//********** [any_of] *************************
//********* [Algorithm Complexity: O(N)] ****************
template <class InputIterator, class UnaryPredicate>
bool any_of(InputIterator first, InputIterator last, UnaryPredicate pred){
for (; first != last; ++first){
if (pred(*first))
return true;
}
return false;
}
}