Tim Blechmann
I'm rather conversative and prefer a pragma-free workaround: I don't know which exact compiler versions support push_macro etc.
Shouldn't you have # undef foreach after # pragma push_macro("foreach") ?
[push_macro] is supported by msvc for ages and by gcc since 4.6 and clang ...
As for GCC, we're still testing 4.4 (http://tinyurl.com/no2q5wh ). Besides, there are other compilers outside the three big ones, so I'm not so convinced about this patch. I think it's fair to declare Boost.Foreach unusable in the presence of "foreach" macros, and we should only strive to be resilient against these for libs that do not depend on Boost.Foreach (as is the case for Boost.MultiIndex, which merely ensures interoperability with it). So far, direct use of boost_foreach_argument_dependent_lookup_hack seems more robust. Joaquín M López Muñoz Telefónica