2 Copyright (c) Marshall Clow 2017.
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE10.txt or copy at http://www.boost.org/LICENSE10.txt)
8 /// \file for_each_n.hpp
9 /// \brief Apply a functor to the elements of a sequence
10 /// \author Marshall Clow
12 #ifndef BOOST_ALGORITHM_FOR_EACH_N_HPP
13 #define BOOST_ALGORITHM_FOR_EACH_N_HPP
15 #include <utility> // for std::pair
17 namespace boost { namespace algorithm {
19 /// \fn for_each_n(InputIterator first, Size n, Function f);
22 /// \param first The start of the first range.
23 /// \param n One past the end of the first range.
24 /// \param f A functor to apply to the elements of the sequence
25 /// \note If f returns a result, the result is ignored.
26 template<class InputIterator, class Size, class Function>
27 InputIterator for_each_n(InputIterator first, Size n, Function f)
29 for ( ; n > 0; --n, ++first )
35 }} // namespace boost and algorithm
37 #endif // BOOST_ALGORITHM_FOR_EACH_N_HPP