|
Boost : |
Subject: Re: [boost] Call for interest - BOOST_AUTO_FUNCTION
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2010-10-06 16:12:57
On Tue, Oct 5, 2010 at 3:57 PM, David Abrahams <dave_at_[hidden]> wrote:
> I always imagined I'd want something like that when I started using
> C++0x in anger.
>
> --
> Dave Abrahams
> BoostPro Computing
> http://www.boostpro.com
>
The frustrating thing is that I'm pretty sure most people who first hear
about auto when applied to function templates assume that it would mean
something along the lines of what the macro does, and then they are
disappointed to find out that that is not the case. I agree that for
arbitrarily long functions with many statements and returns it would not be
appropriate, but for 1-liners it seems like something that's both an
extremely common case and trivial for compilers to implement. At least for
me, it seems that the vast majority of the times one wants to use the
function arguments when specifying the return type it is to duplicate the
expression in a return statement exactly anyway. Was such an idea simply
never proposed despite everyone I've talked to expecting it to be there? It
wouldn't surprise me if the next standard remedied this, but at the moment
that seems light years away.
-- -Matt Calabrese
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk