Home | Libraries | People | FAQ | More |
template< class SinglePassRange1, class SinglePassRange2, class BinaryFunction > BinaryFunction for_each(const SinglePassRange1& rng1, const SinglePassRange2& rng2, BinaryFunction fn); template< class SinglePassRange1, class SinglePassRange2, class BinaryFunction > BinaryFunction for_each(const SinglePassRange1& rng1, SinglePassRange2& rng2, BinaryFunction fn); template< class SinglePassRange1, class SinglePassRange2, class BinaryFunction > BinaryFunction for_each(SinglePassRange1& rng1, const SinglePassRange2& rng2, BinaryFunction fn); template< class SinglePassRange1, class SinglePassRange2, class BinaryFunction > BinaryFunction for_each(SinglePassRange1& rng1, SinglePassRange2& rng2, BinaryFunction fn);
for_each
traverses forward
through rng1
and rng2
simultaneously. For each iteration,
the element x
is used
from rng1
and the corresponding
element y
is used from
rng2
to invoke fn(x,y)
.
Iteration is stopped upon reaching the end of the shorter of rng1
, or rng2
.
It is safe to call this function with unequal length ranges.
Defined in the header file boost/range/algorithm_ext/for_each.hpp
SinglePassRange1
is
a model of the Single
Pass Range Concept.
SinglePassRange2
is
a model of the Single
Pass Range Concept.
BinaryFunction
is a
model of the BinaryFunctionConcept
.
SinglePassRange1
's
value type is convertible to BinaryFunction
's
first argument type.
SinglepassRange2
's
value type is convertible to BinaryFunction
's
second argument type.
Linear. Exactly min(distance(rng1), distance(rng2))
applications of BinaryFunction
.