完成all_of
This commit is contained in:
@@ -177,6 +177,16 @@ namespace TinySTL{
|
|||||||
}
|
}
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user