|
Boost : |
From: Vladimir Ciobanu (psycho_at_[hidden])
Date: 2002-02-21 05:57:43
----- Original Message -----
From: "Herb Sutter" <hsutter_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, February 21, 2002 8:54 AM
Subject: [boost] Auto specification
> Thanks for all the replies. I'm digesting them.
>
> What are the exact semantics of auto?
>
> It sounds like the deduced type is not always the exact type, but rather
the
> exact type stripped of something -- of references? of const? of volatile?
of
> something else?
>
> What does auto do exactly in the following cases:
>
> T& foo();
> auto x = foo();
T
> const T bar();
> auto y = bar();
T
>
I'd say it strips "everything" leaving the "pure" type. I'll let
examples speak:
T& foo( );
auto a = foo( ); // a is T
const auto b = foo( ); // b is const T
const auto& c = foo( ); // c is const T&
PS: I'd like the same semantics for typeof( ). Something like:
const T& a;
typeof( a ) == typeof( T);
typeof( const a ) == typeof( const T);
typeof( const a&) == typeof( const T&);
Vlad
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk