Boost logo

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
> exact type stripped of something -- of references? of const? of volatile?
> something else?
> What does auto do exactly in the following cases:
> T& foo();
> auto x = foo();
> const T bar();
> auto y = bar();
    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&);


Boost list run by bdawes at, gregod at, cpdaniel at, john at