
At Sat, 18 Dec 2010 07:20:56 +0900, Michel MORIN wrote:
#ifndef BOOST_NO_RANGE_BASED_FOR namespace boost { using std::begin;
// has_begin metafunction...
template <typename Range> inline typename boost::range_iterator<Range>::type begin(Range& rng, typename disable_if<range_detail::has_begin<Range>>::type* = 0) { return range_begin(rng); }
// const version ... } #else // existing code...
For details, see the attached. I also attach a patch for Boost.Config to add BOOST_NO_RANGE_BASED_FOR. Any comments or thoughs?
First, Michel, thanks for addressing this important matter. 2nd, I'm a wee bit worried about ODR issues. At first it looks like you're saying to define has_begin in namespace boost. Then your code seems to imply it's in namespace range_detail. I think the latter is probably OK, but not the former. The key thing is that the definition of boost::begin should not itself alter the result of has_begin for any given type. -- Dave Abrahams BoostPro Computing http://www.boostpro.com