3 * - By John Hodge (thePowersGang)
6 * - C++'s generic algorithms
8 #ifndef _LIBCXX_ALGORITHM_
9 #define _LIBCXX_ALGORITHM_
13 #include "_libcxx_helpers.h"
17 // --- Non-modifiying sequence operations ---
23 template <class InputIterator, class Function>
24 Function for_each(InputIterator first, InputIterator last, Function fn)
26 while( first != last )
31 return _CXX11_MOVE(fn);
34 template <class InputIterator, class T>
35 InputIterator find(InputIterator first, InputIterator last, const T& val)
37 while( first != last )
46 // TODO: find_if_not (C++11)
48 // TODO: find_first_of
52 const T& max(const T& a, const T& b)
57 template <class T, class Compare>
58 const T& max(const T& a, const T& b, Compare comp)
60 return comp(a, b) ? b : a;
64 const T& min(const T& a, const T& b)
69 template <class T, class Compare>
70 const T& min(const T& a, const T& b, Compare comp)
72 return comp(a, b) ? a : b;