|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-03-03 23:40:11
"Joel de Guzman" <joel_at_[hidden]> wrote in message
news:4046A2AE.8020408_at_boost-consulting.com...
> Jonathan Turkanis wrote:
>
> >
> > How about:
> >
> > unsigned long n = std::accumulate(
> > xs.begin(), xs.end(), 0UL,
> > auto(long lhs, const auto& rhs) // inline fn
with no
> > name.
> > {
> > return lhs + rhs.count;
> > }
> > );
>
> I would prefer also eliding the argument types:
>
> unsigned long n = std::accumulate(
> xs.begin(), xs.end(), 0UL,
> lambda(lhs, rhs)
> {
> return lhs + rhs.count;
> }
> );
>
> Most of the time, you also do not know the type of the
> arguments before hand.
That's why I used 'auto'. (Maybe I should have used it for the first
argument position, too.)
Isn't it useful to have a way to specify whether the argument is to be
passed by value, reference, const reference, etc. ?
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk