On 25 March 2011 14:22, Rodrigo Rivas wrote: > On Fri, Mar 25, 2011 at 1:33 PM, Jonathan Wakely <jwakely....@gmail.com> > wrote: >> Yes but it's too late to specify it in C++0x. >> >> Boost.Range is the best place to work on that idea at present. >> If/when it's fully baked I hope we'll see something like that in a >> future TR or standard. > > Agreed. > But just now, how would you explain if the following to loops behave > differently? > > template<typename T> void foo(T &t) > { > for (auto i : t) > ; > for (auto i : boost::any_range(t)) > ; > } > > Because the boost::any_range constructor is unable to replicate the > logic from the range-for?
I would say different behaviour is better than an unpreventable compiler error, which is what happened when combining range-based for and Boost.Range a few months ago.