diff --git a/TinySTL/Algorithm.h b/TinySTL/Algorithm.h index 12d8cf0..661e5bd 100644 --- a/TinySTL/Algorithm.h +++ b/TinySTL/Algorithm.h @@ -4,7 +4,7 @@ #include namespace TinySTL{ - //********* fill ******************** + //********* [fill] ******************** template void fill(ForwardIterator first, ForwardIterator last, const T& value) { @@ -19,7 +19,7 @@ namespace TinySTL{ { memset(first, static_cast(value), (last - first) * sizeof(wchar_t)); } - //********* fill_n ******************** + //********* [fill_n] ******************** template OutputIterator fill_n(OutputIterator first, Size n, const T& value) { @@ -39,6 +39,15 @@ namespace TinySTL{ memset(first, static_cast(value), n * sizeof(wchar_t)); return first + n; } + //************ [find] **************** + template + InputIterator find(InputIterator first, InputIterator last, const T& val){ + for (; first != last; ++first){ + if (*first == val) + break; + } + return first; + } } #endif \ No newline at end of file