|
Boost Users : |
From: me22 (me22.ca_at_[hidden])
Date: 2006-09-15 22:03:39
On 9/15/06, Alexander Shyrokov <shirokov_at_[hidden]> wrote:
> Could you explain why _2 is used? It looks like f parameter should have
> two parameters and we are using bind to use only 2nd parameter and
> ignore the first one? Is it correct?
>
boost::bind( f, _2 ) is generating a binary functor that, when called,
calls the unary function f and passes it the second argument to the
functor.
> The second question: why last is not a constant and maybe taken by
> reference? void for_each_pair( It first, const It& last, F f )
>
Iterators are supposed to be cheap to copy and as far as I can tell
it's just the usual way to pass the end iterator. There might also be
some weird issues with argument deduction in some compilers. ( I seem
to recall something about that... )
HTH,
Scott
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net