Algorithms Emulation C++03
Added in 1.34.0

Boost.Foreach

In C++, writing a loop that iterates over a sequence is tedious. We can either use iterators, which requires a considerable amount of boiler-plate, or we can use the std::for_each() algorithm and move our loop body into a predicate, which requires no less boiler-plate and forces us to move our logic far from where it will be used. In contrast, some other languages, like Perl, provide a dedicated "foreach" construct that automates this process. BOOST_FOREACH is just such a construct for C++. It iterates over sequences for us, freeing us from having to deal directly with iterators or write predicates.

About Boost.Foreach

Please check out the library's documentation to learn more.

In Progress Branch

You are viewing the master version of this library.

The master and develop pages are shown here to provide access to the newest in-development in-progress documentation. See the "Documentation" link on this page.

Other aspects of the page will reflect the previous official version, or not be available until the next release.

Contributors: This Release


Documentation
⚠️ This library has no README.md or library-details.adoc; consider contributing one.
Join the Boost Developers Mailing List

Get the latest on releases, features, security patches, fixes and all major announcements.

All Contributors