Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-12-19 00:05:24

BOOST_FOREACH is a macro which makes it simple to iterate over a
sequence. It is concise, and clearly expresses the programmer's
intentions. For example:

     short array_short[] = {1,2,3};
     BOOST_FOREACH( short & i, array_short )
     // array_short contains {2,3,4} here

Recent changes I have made to the macro have greatly increased its
safety and usefulness. It gracefully handles both L-value and R-value
sequence expression, and evaluates its arguments only once. It now works
(to a greater or lesser extent) on a wide range of compilers, even VC6.

The current implementation, documentation and tests can be found in the
Boost Sandbox File Vault. You can download the Zip file here:

Tinyurl link redirects to:

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at