31 template<
class InputIterator,
class T>
32 inline bool __any( InputIterator first, InputIterator last,
const T& value, std::input_iterator_tag ){
33 for ( ;first!=last; first++)
if ( *first==value )
return true;
38 template<
class RandomAccessIterator,
class T>
39 inline bool __any( RandomAccessIterator __first, RandomAccessIterator __last,
const T& __val, std::random_access_iterator_tag ){
41 typename std::iterator_traits<RandomAccessIterator>::difference_type __trip_count = (__last - __first) >> 2;
43 for ( ; __trip_count > 0 ; --__trip_count) {
44 if (*__first == __val)
48 if (*__first == __val)
52 if (*__first == __val)
56 if (*__first == __val)
61 switch (__last - __first)
64 if (*__first == __val)
68 if (*__first == __val)
72 if (*__first == __val)
88 template<
class InputIterator,
class T>
89 inline bool any( InputIterator first, InputIterator last,
const T& value){
90 return __any( first, last, value,
typename std::iterator_traits<InputIterator>::iterator_category() ) ;
97 template<
class InputIterator,
class Predicate>
98 inline bool __any_if( InputIterator first, InputIterator last, Predicate pred, std::input_iterator_tag ){
99 for ( ; first!=last ; first++ )
if ( pred(*first) )
return true ;
104 template<
class RandomAccessIterator,
class Predicate>
105 inline bool __any_if( RandomAccessIterator __first, RandomAccessIterator __last, Predicate __pred, std::random_access_iterator_tag ){
107 typename std::iterator_traits<RandomAccessIterator>::difference_type __trip_count = (__last - __first) >> 2;
109 for ( ; __trip_count > 0 ; --__trip_count) {
110 if (__pred(*__first))
114 if (__pred(*__first))
118 if (__pred(*__first))
122 if (__pred(*__first))
127 switch (__last - __first)
130 if (__pred(*__first))
134 if (__pred(*__first))
138 if (__pred(*__first))
154 template<
class InputIterator,
class Predicate>
155 inline bool any_if( InputIterator first, InputIterator last, Predicate pred){
156 return __any_if( first, last, pred,
typename std::iterator_traits<InputIterator>::iterator_category() ) ;
bool any_if(InputIterator first, InputIterator last, Predicate pred)
bool any(InputIterator first, InputIterator last, const T &value)
bool __any_if(InputIterator first, InputIterator last, Predicate pred, std::input_iterator_tag)
bool __any(InputIterator first, InputIterator last, const T &value, std::input_iterator_tag)