Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-05-11 15:26:00


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:001a01c55665$4525adb0$6401a8c0_at_pdimov2...
| Thorsten Ottosen wrote:
| > "Peter Dimov" <pdimov_at_[hidden]> wrote in message
| > news:011e01c5565c$b9f22000$6401a8c0_at_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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk