
On 17.12.2010, at 17:35, Michel MORIN wrote:
Sebastian Redl wrote:
C++0x range-based for is available on GCC 4.6 (Pre-release). There is no BOOST_NO_RANGE_BASED_FOR macro, so I made a patch against trunk and made a test case. Please see attached files. Is it reasonable to add this macro?
I don't think there's really a point, unless you want Boost's users to use the config macros. Range-based for is a convenience functionality, not an enabling functionality. In other words, if you can't use it all the time, but have to write the long form anyway, what's the point in using it?
Range-based for conflicts with many Boost libraries. This issue can be resolved by fixing boost/range/begin.hpp and boost/range/end.hpp, which needs BOOST_NO_RANGE_BASED_FOR macro.
No, a standard library that provides std::begin() and std::end() conflicts with boost::begin() and boost::end() provided by Boost.Range. These functions are used by for-range, so their existence is a requirement for a compiler supporting for-range on anything but arrays, but the language feature itself has nothing to do with the conflict. This is important because, for example, libc++ already has std::begin() and std::end(), but Clang doesn't yet support for-range.
Yeah, we can always use BOOST_FOREACH instead of range-based for. And considering portability, BOOST_FOREACH is a must. But IMHO it's a pity that users of the Boost libraries are recommended not to use a language feature.
Er, what? Who recommended that Boost users not use a language feature? Dave merely said that Boost authors should just use BOOST_FOREACH. Sebastian