Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2002-02-18 11:01:49

joel de guzman wrote:
> Next to typeof(x), I'd love to see Dave (Abraham's) "auto" for type deduction.
> auto v = an_arbitrarily_complex_expression;

I'm reading all those pro-'auto' comments with a little fear. Why it
'auto' really needed if we have a good typeof? Example:

std::vector< ...complex sub-types, ... > v;
for( typeof( v )::const_iterator it = v.begin(); it != v.end(); ++it ) {
... }

or another one:

auto x = func< T, U, V >();

without auto, but with typeof:

typedef typeof( func< T, U, V >() ) func_return_type;
func_return_type x = func< T, U, V >();

IMHO, typeof() is really necessary, but auto is just eye-candy. I cannot
see something that an 'auto'-type can do you couldn't do with typeof()
and the current language. Instead, it weakens the strong-type-checking
for which I like C++. (I know my english is horrible, but I hope you get
what I mean :). If I missed something about 'auto', please let me know.

Regards, Daniel

BTW: Is this discussion OK for boost? As long as nobody objects I'll
continue with it :)

Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web:

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