stlab.adobe.com Adobe Systems Incorporated
for_each_position.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_FOR_EACH_POSITION_HPP
10 #define ADOBE_ALGORITHM_FOR_EACH_POSITION_HPP
11 
12 #include <adobe/config.hpp>
13 
14 #include <boost/bind.hpp>
15 #include <boost/range/begin.hpp>
16 #include <boost/range/end.hpp>
17 
18 #include <algorithm>
19 
20 /*************************************************************************************************/
21 
22 namespace adobe {
23 
24 /*************************************************************************************************/
36 /*************************************************************************************************/
37 #ifndef ADOBE_NO_DOCUMENTATION
38 namespace implementation {
39 
40 /*************************************************************************************************/
41 
42 template <class InputIterator, class UnaryFunction>
43 void for_each_position(InputIterator first, InputIterator last, UnaryFunction f)
44 {
45  while (first != last)
46  {
47  f(first);
48  ++first;
49  }
50 }
51 
52 /*************************************************************************************************/
53 
54 } // namespace implementation
55 #endif
56 /*************************************************************************************************/
62 template <class InputIterator, class UnaryFunction>
63 inline void for_each_position(InputIterator first, InputIterator last, UnaryFunction f)
64 {
65  adobe::implementation::for_each_position(first, last, boost::bind(f, _1));
66 }
67 
73 template <class InputRange, class UnaryFunction>
74 inline void for_each_position(InputRange& range, UnaryFunction f)
75 {
76  adobe::for_each_position(boost::begin(range), boost::end(range), f);
77 }
78 
84 template <class InputRange, class UnaryFunction>
85 inline void for_each_position(const InputRange& range, UnaryFunction f)
86 {
87  adobe::for_each_position(boost::begin(range), boost::end(range), f);
88 }
89 
90 /*************************************************************************************************/
91 
92 } // namespace adobe
93 
94 /*************************************************************************************************/
95 
96 #endif
97 
98 /*************************************************************************************************/
void for_each_position(InputIterator first, InputIterator last, UnaryFunction f)
for_each_position implementation
void for_each_position(const InputRange &range, UnaryFunction f)
for_each_position implementation

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