Boost logo

Boost :

From: brianjparker (brianjparker_at_[hidden])
Date: 2002-02-21 06:58:23


--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> From: "Herb Sutter" <hsutter_at_a...>
> > Thanks for all the replies. I'm digesting them.
> >
> > What are the exact semantics of auto?
>
> auto x = expr;
> // do something with x
>
> is equivalent to
>
> template<class X> void do_something_with_x(X x);
> do_something_with_x(expr);

That's precisely why I would favour using the same template syntax
for argument and local variable (and function return) type deduction-
they are all equivalent.

i.e.

template<typename R, typename A, typename L>
R func(A a)
{
   const L& x = exp;
}

instead of

template<typename A>
auto func(A a)
{
   const auto& x = exp;
}

,Brian Parker


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