Boost logo

Boost :

From: Emily Winch (emily_at_[hidden])
Date: 2002-02-19 05:24:12


>
> You already mention one drawback. Why not think of a better solution? It
> is just me feeling that there *is* a better solution? I don't like to
> give up so soon and accept 'auto' as a keyword. For the example above,
>
> for( typeof( v )::const_iterator it = v.begin(); it != v.end(); ++it
> )
>
> or, as Wilka suggested 'v::const_iterator', has more power and is still
> a good improvement over the current situation. Especially the people at
> boost have shown what is possible to do with a minimalistic language and
> the right ideas.

If it wasn't for the following, I'd agree with you:

template<typename T, int I>
auto foo(T t, T* pt, double a, std::string b){
 //...
}

but how on earth would you do _that_ with typeof?

template<typename T, int I>
typeof(foo<T, I>(T(), 0, 0.0, "")) // yuk, yuk, yuk
foo(T t, T* pt, double a, std::string b){
  // ...
}

To me function declarations are the main argument for auto: and once
you have it there, you might as well have it in

auto x = foo<int, 1>( /* bla */ );

Emily


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