Boost logo

Boost :

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

Daniel Frey said:

[ snipped my example of function declared using auto ]

> 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').

The compiler is expected to barf if it can't see the definition. People who
need to export their template code will just have to Not Use Auto.

"auto" certainly won't give us _more_ "inline" functions than we already
at the moment. "auto" is useless with functions that aren't templates, and
those functions are already "inline".

IMO the advantages of using auto _for some functions_ by far outweigh the
disadvantages of not being able to export the template. The workarounds for
not having auto get stinky really quickly (for both the author and the user
the code) once you get into even slightly complicated metaprogramming. If I
_need_ to export the template, nothing forces me to use auto: the stinky
workarounds will still be there :)


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