完成find
This commit is contained in:
1 parent
4c2cf22402
commit
f8f2233088
1 file changed
+10
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user