18 #ifndef LUNCHBOX_ALGORITHM_H 19 #define LUNCHBOX_ALGORITHM_H 21 #include <lunchbox/compiler.h> 25 #ifdef LB_GCC_4_4_OR_LATER 26 #include <parallel/algorithm> 32 #ifdef LB_USE_STD_PARALLEL 33 using std::__parallel::sort;
40 typename std::vector<T>::iterator
find(std::vector<T>& container,
43 return std::find(container.begin(), container.end(), element);
48 typename std::vector<T>::const_iterator
find(
const std::vector<T>& container,
51 return std::find(container.begin(), container.end(), element);
55 template <
typename T,
typename P>
56 typename std::vector<T>::iterator
find_if(std::vector<T>& container,
59 return std::find_if(container.begin(), container.end(), predicate);
63 template <
typename T,
typename P>
64 typename std::vector<T>::const_iterator
find_if(std::vector<const T>& container,
67 return std::find_if(container.begin(), container.end(), predicate);
74 std::sort(c.begin(), c.end());
75 c.erase(std::unique(c.begin(), c.end()), c.end());
79 #endif // LUNCHBOX_ALGORITHM_H std::vector< T >::iterator find_if(std::vector< T > &container, const P &predicate)
Find the element matching the predicate.
std::vector< T >::iterator find(std::vector< T > &container, const T &element)
Find the element in the given vector.
Abstraction layer and common utilities for multi-threaded programming.
void usort(C &c)
Uniquely sort and eliminate duplicates in a container.