|
Boost : |
From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2002-02-19 05:46:02
Emily Winch wrote:
>
> >
> > 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?
And how would you forward-declare this function? What is the compiler
expected to return without seeing the function's definition? I don't
think that it is a good idea to allow 'auto' for return types. (And yes,
typeof() doesn't work too, for the same reason). IMHO this leads to even
more forced 'inline'-functions like templates already gave us (as
compilers don't support 'export').
Regards, Daniel
-- 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: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk