Boost logo

Boost :

Subject: Re: [boost] Call for interest - BOOST_AUTO_FUNCTION
From: David Abrahams (dave_at_[hidden])
Date: 2010-10-07 07:18:24

At Wed, 6 Oct 2010 16:12:57 -0400,
Matt Calabrese wrote:
> 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
> >
> >
> 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.

Agreed; it's lame.

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

No, it was proposed. I don't remember why it was shot down.

Dave Abrahams
BoostPro Computing

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