18 #ifndef LUNCHBOX_ALGORITHM_H 
   19 #define LUNCHBOX_ALGORITHM_H 
   21 #include <lunchbox/compiler.h> 
   25 #ifndef __MINGW32__ // MinGW does not provide the header 
   26 #  ifdef LB_GCC_4_4_OR_LATER 
   27 #    include <parallel/algorithm> 
   28 #    define LB_USE_STD_PARALLEL 
   35 #ifdef LB_USE_STD_PARALLEL 
   36 using std::__parallel::sort;
 
   42 template< 
typename T > 
typename std::vector< T >::iterator
 
   43 find( std::vector< T >& container, 
const T& element )
 
   44     { 
return std::find( container.begin(), container.end(), element ); }
 
   47 template< 
typename T > 
typename std::vector< T >::const_iterator
 
   48 find( 
const std::vector< T >& container, 
const T& element )
 
   49     { 
return std::find( container.begin(), container.end(), element ); }
 
   52 template< 
typename T, 
typename P > 
typename std::vector< T >::iterator
 
   53 find_if( std::vector< T >& container, 
const P& predicate )
 
   54     { 
return std::find_if( container.begin(), container.end(), predicate );}
 
   57 template< 
typename T, 
typename P > 
typename std::vector<T>::const_iterator
 
   58 find_if( std::vector< const T >& container, 
const P& predicate )
 
   59     { 
return std::find_if( container.begin(), container.end(), predicate );}
 
   62 template< 
typename C > 
void usort( C& c )
 
   64     std::sort( c.begin(), c.end( ));
 
   65     c.erase( std::unique( c.begin(), c.end( )), c.end( ));
 
   70 #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. 
 
void usort(C &c)
Uniquely sort and eliminate duplicates in a container.