
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 ) { ++i; } // 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: http://tinyurl.com/57oyp Tinyurl link redirects to: http://boost-sandbox.sourceforge.net/vault/index.php?action=downloadfile&filename=foreach.zip&directory=eric_niebler& -- Eric Niebler Boost Consulting www.boost-consulting.com