|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-03-03 16:09:19
David Abrahams wrote:
>
> I realize that I can use bind:
>
>
> unsigned long n = std::accumulate(
> xs.begin(), xs.end(), 0UL,
> _1 + bind(&X::count,_2));
>
> but that's slightly counter-intuitive since the order of the target
> object and its member pointer are reversed.
It sure would've been nice to be able to write _2.count, or count(_2), or
_2.count(), but we can't, so we bind(). ;-) The regular syntax has its
advantages, and the initial "member pointer first" surprise is a one-time
adjustment.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk