|
Go to the documentation of this file.
9 #ifndef ADOBE_ALGORITHM_SEARCH_HPP
10 #define ADOBE_ALGORITHM_SEARCH_HPP
14 #include <boost/range/begin.hpp>
15 #include <boost/range/end.hpp>
16 #include <boost/bind.hpp>
39 template < class ForwardRange1, class ForwardRange2>
40 inline typename boost::range_const_iterator<ForwardRange1>::type
41 search( const ForwardRange1& range1, const ForwardRange2& range2)
43 return std::search(boost::begin(range1), boost::end(range1),
44 boost::begin(range2), boost::end(range2));
52 template < class ForwardRange1, class ForwardRange2>
53 inline typename boost::range_iterator<ForwardRange1>::type
54 search(ForwardRange1& range1, const ForwardRange2& range2)
56 return std::search(boost::begin(range1), boost::end(range1),
57 boost::begin(range2), boost::end(range2));
65 template < class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
66 inline ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1,
67 ForwardIterator2 first2, ForwardIterator2 last2,
70 return std::search(first1, last1, first2, last2, boost::bind(pred, _1, _2));
78 template < class ForwardRange1, class ForwardRange2, class BinaryPredicate>
79 inline typename boost::range_iterator<ForwardRange1>::type search(ForwardRange1& range1,
80 const ForwardRange2& range2,
83 return adobe::search(boost::begin(range1), boost::end(range1),
84 boost::begin(range2), boost::end(range2),
93 template < class ForwardRange1, class ForwardRange2, class BinaryPredicate>
94 inline typename boost::range_const_iterator<ForwardRange1>::type search( const ForwardRange1& range1,
95 const ForwardRange2& range2,
98 return adobe::search(boost::begin(range1), boost::end(range1),
99 boost::begin(range2), boost::end(range2),
108 template < class ForwardRange, class Size, class T>
109 inline typename boost::range_iterator<ForwardRange>::type
112 return std::search_n(boost::begin(range), boost::end(range), count, value);
120 template < class ForwardRange, class Size, class T>
121 inline typename boost::range_const_iterator<ForwardRange>::type
124 return std::search_n(boost::begin(range), boost::end(range), count, value);
132 template < class ForwardIterator, class Size, class T, class BinaryPredicate>
133 inline ForwardIterator
134 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value, BinaryPredicate pred)
136 return std::search_n(first, last, count, value, boost::bind(pred, _1, _2));
144 template < class ForwardRange, class Size, class T, class BinaryPredicate>
145 inline typename boost::range_iterator<ForwardRange>::type
146 search_n(ForwardRange& range, Size count, const T& value, BinaryPredicate pred)
148 return adobe::search_n(boost::begin(range), boost::end(range), count, value, pred);
156 template < class ForwardRange, class Size, class T, class BinaryPredicate>
157 inline typename boost::range_const_iterator<ForwardRange>::type
158 search_n( const ForwardRange& range, Size count, const T& value, BinaryPredicate pred)
160 return adobe::search_n(boost::begin(range), boost::end(range), count, value, pred);
|