|
Go to the documentation of this file.
9 #ifndef ADOBE_ALGORITHM_FIND_HPP
10 #define ADOBE_ALGORITHM_FIND_HPP
17 #include <boost/range/begin.hpp>
18 #include <boost/range/end.hpp>
19 #include <boost/next_prior.hpp>
20 #include <boost/bind.hpp>
79 template < class InputIterator, class Predicate>
80 inline InputIterator find_if_not(InputIterator first, InputIterator last, Predicate pred)
82 return std::find_if(first, last, !boost::bind(pred, _1));
90 template < class InputRange, class Predicate>
91 inline typename boost::range_iterator<InputRange>::type
102 template < class InputRange, class Predicate>
103 inline typename boost::range_const_iterator<InputRange>::type
114 template < class InputIterator, class T>
115 inline InputIterator find_not(InputIterator first, InputIterator last, const T& value)
117 return std::find_if(first, last, boost::bind(std::not_equal_to<T>(), value, _1));
125 template < class InputRange, class T>
126 inline typename boost::range_iterator<InputRange>::type
137 template < class InputRange, class T>
138 inline typename boost::range_const_iterator<InputRange>::type
149 template < class InputRange, class T>
150 inline typename boost::range_iterator<InputRange>::type
151 find(InputRange& range, const T& value)
153 return std::find(boost::begin(range), boost::end(range), value);
161 template < class InputRange, class T>
162 inline typename boost::range_const_iterator<InputRange>::type
163 find( const InputRange& range, const T& value)
165 return std::find(boost::begin(range), boost::end(range), value);
173 template < class InputIterator, class Predicate>
174 inline InputIterator find_if(InputIterator first, InputIterator last, Predicate pred)
176 return std::find_if(first, last, boost::bind(pred, _1));
184 template < class InputRange, class Predicate>
185 inline typename boost::range_iterator<InputRange>::type
188 return adobe::find_if(boost::begin(range), boost::end(range), pred);
196 template < class InputRange, class Predicate>
197 inline typename boost::range_const_iterator<InputRange>::type
198 find_if( const InputRange& range, Predicate pred)
200 return adobe::find_if(boost::begin(range), boost::end(range), pred);
207 template < typename I,
212 if (f != l) l = find_not(boost::next(f), l, x);
220 template < typename I,
234 template < class ForwardRange1, class ForwardRange2>
235 inline typename boost::range_iterator<ForwardRange1>::type
236 find_end(ForwardRange1& range1, const ForwardRange2& range2)
238 return std::find_end(boost::begin(range1), boost::end(range1),
239 boost::begin(range2), boost::end(range2));
247 template < class ForwardRange1, class ForwardRange2>
248 inline typename boost::range_const_iterator<ForwardRange1>::type
249 find_end( const ForwardRange1& range1, const ForwardRange2& range2)
251 return std::find_end(boost::begin(range1), boost::end(range1),
252 boost::begin(range2), boost::end(range2));
260 template < class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
261 inline ForwardIterator1 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
262 ForwardIterator2 first2, ForwardIterator2 last2,
263 BinaryPredicate comp)
265 return std::find_end(first1, last1, first2, last2, boost::bind(comp, _1, _2));
273 template < class ForwardRange1, class ForwardRange2, class BinaryPredicate>
274 inline typename boost::range_iterator<ForwardRange1>::type
275 find_end(ForwardRange1& range1, const ForwardRange2& range2, BinaryPredicate comp)
278 boost::begin(range2), boost::end(range2),
287 template < class ForwardRange1, class ForwardRange2, class BinaryPredicate>
288 inline typename boost::range_const_iterator<ForwardRange1>::type
289 find_end( const ForwardRange1& range1, const ForwardRange2& range2, BinaryPredicate comp)
292 boost::begin(range2), boost::end(range2),
305 template < class InputRange, class ForwardRange>
306 inline typename boost::range_iterator<InputRange>::type
307 find_first_of(InputRange& range1, const ForwardRange& range2)
309 return std::find_first_of(boost::begin(range1), boost::end(range1),
310 boost::begin(range2), boost::end(range2));
318 template < class InputRange, class ForwardRange>
319 inline typename boost::range_const_iterator<InputRange>::type
320 find_first_of( const InputRange& range1, const ForwardRange& range2)
322 return std::find_first_of(boost::begin(range1), boost::end(range1),
323 boost::begin(range2), boost::end(range2));
331 template < class InputIterator, class ForwardIterator, class BinaryPredicate>
332 inline InputIterator find_first_of(InputIterator first1, InputIterator last1,
333 ForwardIterator first2, ForwardIterator last2,
334 BinaryPredicate comp)
337 return std::find_first_of(first1, last1, first2, last2, boost::bind(comp, _1, _2));
345 template < class InputRange, class ForwardRange, class BinaryPredicate>
346 inline typename boost::range_iterator<InputRange>::type
347 find_first_of(InputRange& range1, const ForwardRange& range2, BinaryPredicate comp)
349 return adobe::find_first_of(boost::begin(range1), boost::end(range1),
350 boost::begin(range2), boost::end(range2),
359 template < class InputRange, class ForwardRange, class BinaryPredicate>
360 inline typename boost::range_const_iterator<InputRange>::type
361 find_first_of( const InputRange& range1, const ForwardRange& range2, BinaryPredicate comp)
363 return adobe::find_first_of(boost::begin(range1), boost::end(range1),
364 boost::begin(range2), boost::end(range2),
375 template < class ForwardRange>
376 inline typename boost::range_iterator<ForwardRange>::type adjacent_find(ForwardRange& range)
386 template < class ForwardRange>
387 inline typename boost::range_const_iterator<ForwardRange>::type
398 template < class ForwardIterator, class BinaryPredicate>
399 inline ForwardIterator
400 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred)
410 template < class ForwardRange, class BinaryPredicate>
411 inline typename boost::range_iterator<ForwardRange>::type
422 template < class ForwardRange, class BinaryPredicate>
423 inline typename boost::range_const_iterator<ForwardRange>::type
|