完成find

This commit is contained in:
邹晓航
2014-10-18 19:56:57 +08:00
parent 4c2cf22402
commit f8f2233088

View File

@@ -215,6 +215,16 @@ namespace TinySTL{
fn(*first);
return fn;
}
//********** [find] *************************
//********* [Algorithm Complexity: O(N)] ****************
template <class InputIterator, class T>
InputIterator find(InputIterator first, InputIterator last, const T& val){
for (; first != last; ++first){
if (*first == val)
break;
}
return first;
}
}