
"Peter Dimov" <pdimov@mmltd.net> wrote in message news:001a01c55665$4525adb0$6401a8c0@pdimov2... | Thorsten Ottosen wrote: | > "Peter Dimov" <pdimov@mmltd.net> wrote in message | > news:011e01c5565c$b9f22000$6401a8c0@pdimov2... | | >>> template< class T > | >>> auto begin( MyType<T>&& r ) -> decltype( r.Begin() ) | >>> { | >>> return r.Begin(); | >>> } | >> | >> And | > | > no. | > | >> template< class T > | >> auto begin( MyType<T> const && r ) -> decltype( r.Begin() ) | >> { | >> return r.Begin(); | >> } | | No, meaning that you want to disallow iteration on const MyType<T>? | | Have you actually _tried_ any of this? I haven't tried any of which can only be done in C++0x. I haven't implemented the new for loop in any compiler. what's your point? | Have you tried your own example | before putting it into the paper? which example? I don't know why you insists that we need two overloads. Given template< class T > MyType { Iter Begin(); ConstIter Begin() const; ... }; surely template< class T > auto begin( MyType<T>&& r ) -> decltype( r.Begin() ) { return r.Begin(); } can handle both const and non-const arguments. What am I missing if that is not true. -Thorsten