X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibc%2B%2B.so_src%2Finclude_exp%2Falgorithm;fp=Usermode%2FLibraries%2Flibc%2B%2B.so_src%2Finclude_exp%2Falgorithm;h=c08e28f3e538980fc2f0533b99be0aaff6783fa8;hb=145dd00e5c5a36f844be327e16a00b2983245423;hp=b02f5b0d9e33e67ab7917393dfe4b4ea8ccc121a;hpb=1aed2067a0f084e9c5fa1af48e177e28a81466bc;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libc++.so_src/include_exp/algorithm b/Usermode/Libraries/libc++.so_src/include_exp/algorithm index b02f5b0d..c08e28f3 100644 --- a/Usermode/Libraries/libc++.so_src/include_exp/algorithm +++ b/Usermode/Libraries/libc++.so_src/include_exp/algorithm @@ -2,14 +2,51 @@ * Acess2 C++ Library * - By John Hodge (thePowersGang) * - * string (header) - * - C++'s String type + * algorithm (header) + * - C++'s generic algorithms */ #ifndef _LIBCXX_ALGORITHM_ #define _LIBCXX_ALGORITHM_ +#include + +#include "_libcxx_helpers.h" + namespace std { +// --- Non-modifiying sequence operations --- +#if _CXX11_AVAIL +// TODO: all_of +// TODO: any_of +// TODO: none_of +#endif +template +Function for_each(InputIterator first, InputIterator last, Function fn) +{ + while( first != last ) + { + fn( *first ); + ++ first; + } + return _CXX11_MOVE(fn); +} + +template +InputIterator find(InputIterator first, InputIterator last, const T& val) +{ + while( first != last ) + { + if( *first == val ) + return first; + ++ first; + } + return last; +} +// TODO: find_if +// TODO: find_if_not (C++11) +// TODO: find_end +// TODO: find_first_of + // Maximum template const T& max(const T& a, const T& b)