
Quoting "vicente.botet" <vicente.botet@wanadoo.fr>:
----- Original Message ----- From: "Peter Bartlett" <pete@pcbartlett.com> To: <boost@lists.boost.org> Sent: Wednesday, January 21, 2009 9:46 AM Subject: Re: [boost] A PP trick to define a synchronized blockjava-like macro
Quoting John Bytheway <jbytheway+boost@gmail.com>:
if (bool stop_ = false) {} else for (VARS DECLARATION; !stop_; stop_ = true)
which I'd consider more readable (Thanks to BOOST_FOREACH for this trick).
John Bytheway
The other trick in this part of the book is to use nested fors, which can give you slightly more flexibility. FOREACH does this too, IIRC.
Hi,
Thanks John for the if else suggestion. I like it. Could some of you point where FOREACH use these tricks?
The main BOOST_FOREACH macro definition (line 1059 in foreach.hpp in version 1.37) uses four nested ifs. It uses a nested for too - the last for is the "real" for loop!