...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Algorithms / Runtime Algorithms / for_each |
template< typename Sequence , typename F > void for_each( F f ); template< typename Sequence , typename TransformOp , typename F > void for_each( F f );
for_each is a family of overloaded function templates:
#include <boost/mpl/for_each.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Forward Sequence | A sequence to iterate. |
TransformOp | Lambda Expression | A transformation. |
f | An unary function object | A runtime operation to apply. |
For any Forward Sequence s, Lambda Expression op , and an unary function object f:
for_each( f );
Return type: | void |
---|---|
Postcondition: | Equivalent to typedef begin where n == size |
for_each( f );
Return type: | void |
---|---|
Postcondition: | Equivalent to for_each< transform_view |
Linear. Exactly size::value applications of op and f.