1[/ 2 Copyright 2010 Neil Groves 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[section:for_each for_each] 7 8[heading Prototype] 9 10`` 11template< 12 class SinglePassRange, 13 class UnaryFunction 14 > 15UnaryFunction for_each(SinglePassRange& rng, UnaryFunction fun); 16 17template< 18 class SinglePassRange, 19 class UnaryFunction 20 > 21UnaryFunction for_each(const SinglePassRange& rng, UnaryFunction fun); 22`` 23 24[heading Description] 25 26`for_each` traverses forward through `rng` and for each element `x` it invokes `fun(x)`. 27 28[heading Definition] 29 30Defined in the header file `boost/range/algorithm/for_each.hpp` 31 32[heading Requirements] 33 34* `SinglePassRange` is a model of the __single_pass_range__ Concept. 35* `UnaryFunction` is a model of the `UnaryFunctionConcept`. 36* `UnaryFunction` does not apply any non-constant operation through its argument. 37* `SinglePassRange`'s value type is convertible to `UnaryFunction`'s argument type. 38 39[heading Complexity] 40 41Linear. Exactly `distance(rng)` applications of `UnaryFunction`. 42 43[endsect] 44 45 46