stlab.adobe.com Adobe Systems Incorporated
find_match.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
5 */
6 
7 /*************************************************************************************************/
8 
9 #ifndef ADOBE_ALGORITHM_FIND_MATCH_HPP
10 #define ADOBE_ALGORITHM_FIND_MATCH_HPP
11 
12 #include <adobe/config.hpp>
13 
14 #include <boost/range/begin.hpp>
15 #include <boost/range/end.hpp>
16 #include <boost/bind.hpp>
17 
18 #include <algorithm>
19 
20 /*************************************************************************************************/
21 
22 namespace adobe {
23 
24 /*************************************************************************************************/
35 /*************************************************************************************************/
41 template <class InputIterator, class T, class Compare>
42 inline InputIterator
43 find_match(InputIterator first, InputIterator last, const T& value, Compare comp)
44 {
45  return std::find_if(first, last, boost::bind(comp, value, _1));
46 }
47 
53 template <class InputRange, class T, class Compare>
54 inline typename boost::range_iterator<InputRange>::type
55 find_match(InputRange& range, const T& value, Compare comp)
56 {
57  return adobe::find_match(boost::begin(range), boost::end(range), value, comp);
58 }
59 
65 template <class InputRange, class T, class Compare>
66 inline typename boost::range_const_iterator<InputRange>::type
67 find_match(const InputRange& range, const T& value, Compare comp)
68 {
69  return adobe::find_match(boost::begin(range), boost::end(range), value, comp);
70 }
71 
77 template <class InputIterator, class T, class Compare>
78 inline InputIterator find_match(InputIterator first, InputIterator last, const T& value)
79 {
80  return std::find_if(first, last, boost::bind(std::equal_to<T>(), value, _1));
81 }
82 
88 template <class InputRange, class T, class Compare>
89 inline typename boost::range_iterator<InputRange>::type
90 find_match(InputRange& range, const T& value)
91 {
92  return adobe::find_match(boost::begin(range), boost::end(range), value);
93 }
94 
100 template <class InputRange, class T, class Compare>
101 inline typename boost::range_const_iterator<InputRange>::type
102 find_match(const InputRange& range, const T& value)
103 {
104  return adobe::find_match(boost::begin(range), boost::end(range), value);
105 }
106 
107 
108 /*************************************************************************************************/
109 
110 } // namespace adobe
111 
112 /*************************************************************************************************/
113 
114 #endif
115 
116 /*************************************************************************************************/

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google