Boost logo

Boost Users :

Subject: [Boost-users] [foreach] #define foreach BOOST_FOREACH
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2011-11-16 16:41:52


In Boost.Foreach docs, the user is informed about the possibility
to do

#define foreach BOOST_FOREACH

so as to improve readability, provided there's no collisions in
her code with the name 'foreach'. I think this advise is extremely
unfortunate, because the collision happens right within Boost.Foreach
code itself, as it uses the namespace boost::foreach internally. This
results in problems like the one described in

http://lists.boost.org/boost-users/2011/11/71762.php

I think the only viable fix is to rename boost::foreach as
boost::foreach_ or something and assume backwards incompatibility
(as for Boost.MultiIndex, I'd have no problem in syncing up),
unless someone figures out a smarter workaround.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net