完成all_of

This commit is contained in:
邹晓航
2014-10-17 17:25:46 +08:00
parent 02c95de420
commit 4e3993404c

View File

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