Index: boost/range/end.hpp =================================================================== --- boost/range/end.hpp (revision 67285) +++ boost/range/end.hpp (working copy) @@ -17,6 +17,54 @@ #include +#ifndef BOOST_NO_RANGE_BASED_FOR +#include +#include +#include + +namespace boost +{ + +using std::end; + +namespace range_detail +{ + template + struct has_end_impl + { + typedef char true_type; + typedef char false_type[2]; + + template + static true_type& check(S* s_ptr, decltype(s_ptr->end())* = 0); + + template + static false_type& check(...); + + static const bool value = sizeof(check(0)) == sizeof(true_type); + }; + + template + struct has_end : boost::mpl::bool_::value> {}; +} + +template +inline typename boost::range_iterator::type +end(Range& rng, typename disable_if>::type* = 0) +{ + return range_end(rng); +} + +template +inline typename boost::range_iterator::type +end(Range const& rng, typename disable_if>::type* = 0) +{ + return range_end(rng); +} + +} +#else + #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING #include #else @@ -127,5 +175,7 @@ } } +#endif // BOOST_NO_RANGE_BASED_FOR + #endif Index: boost/range/begin.hpp =================================================================== --- boost/range/begin.hpp (revision 67285) +++ boost/range/begin.hpp (working copy) @@ -17,6 +17,54 @@ #include +#ifndef BOOST_NO_RANGE_BASED_FOR +#include +#include +#include + +namespace boost +{ + +using std::begin; + +namespace range_detail +{ + template + struct has_begin_impl + { + typedef char true_type; + typedef char false_type[2]; + + template + static true_type& check(S* s_ptr, decltype(s_ptr->begin())* = 0); + + template + static false_type& check(...); + + static const bool value = sizeof(check(0)) == sizeof(true_type); + }; + + template + struct has_begin : boost::mpl::bool_::value> {}; +} + +template +inline typename boost::range_iterator::type +begin(Range& rng, typename disable_if>::type* = 0) +{ + return range_begin(rng); +} + +template +inline typename boost::range_iterator::type +begin(Range const& rng, typename disable_if>::type* = 0) +{ + return range_begin(rng); +} + +} +#else + #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING #include #else @@ -128,5 +176,7 @@ } } +#endif // BOOST_NO_RANGE_BASED_FOR + #endif