Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
for_each_position.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_FOR_EACH_POSITION_HPP
9#define ADOBE_ALGORITHM_FOR_EACH_POSITION_HPP
10
11#include <adobe/config.hpp>
12
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15
16#include <algorithm>
17#include <functional>
18
19/**************************************************************************************************/
20
21namespace adobe {
22
23/**************************************************************************************************/
35/**************************************************************************************************/
36#ifndef ADOBE_NO_DOCUMENTATION
37namespace implementation {
38
39/**************************************************************************************************/
40
41template <class InputIterator, class UnaryFunction>
42void for_each_position(InputIterator first, InputIterator last, UnaryFunction f) {
43 while (first != last) {
44 f(first);
45 ++first;
46 }
47}
48
49/**************************************************************************************************/
50
51} // namespace implementation
52#endif
53/**************************************************************************************************/
59template <class InputIterator, class UnaryFunction>
60inline void for_each_position(InputIterator first, InputIterator last, UnaryFunction f) {
61 adobe::implementation::for_each_position(first, last, std::bind(f, std::placeholders::_1));
62}
63
69template <class InputRange, class UnaryFunction>
70inline void for_each_position(InputRange& range, UnaryFunction f) {
71 adobe::for_each_position(boost::begin(range), boost::end(range), f);
72}
73
79template <class InputRange, class UnaryFunction>
80inline void for_each_position(const InputRange& range, UnaryFunction f) {
81 adobe::for_each_position(boost::begin(range), boost::end(range), f);
82}
83
84/**************************************************************************************************/
85
86} // namespace adobe
87
88/**************************************************************************************************/
89
90#endif
91
92/**************************************************************************************************/
void for_each_position(InputIterator first, InputIterator last, UnaryFunction f)
for_each_position implementation