完成for_each
This commit is contained in:
@@ -207,6 +207,14 @@ namespace TinySTL{
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//********** [for_each] *************************
|
||||||
|
//********* [Algorithm Complexity: O(N)] ****************
|
||||||
|
template <class InputIterator, class Function>
|
||||||
|
Function for_each(InputIterator first, InputIterator last, Function fn){
|
||||||
|
for (; first != last; ++first)
|
||||||
|
fn(*first);
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user