|
Boost : |
From: me22 (me22.ca_at_[hidden])
Date: 2006-12-08 10:30:43
On 12/7/06, ali f <k9eks_at_[hidden]> wrote:
> a) wrap the function in a struct and overload operator ()
> b) change the signature (but then change all places where you've invoked the
> function already)
>
c) Use Boost.Bind.
>From http://boost.org/libs/bind/bind.html#with_functions :
bind(f, _2, _1)(x, y); // f(y, x)
bind(g, _1, 9, _1)(x); // g(x, 9, x)
bind(g, _3, _3, _3)(x, y, z); // g(z, z, z)
bind(g, _1, _1, _1)(x, y, z); // g(x, x, x)
Note that, in the last example, the function object produced by
bind(g, _1, _1, _1) does not contain references to any arguments
beyond the first, but it can still be used with more than one
argument. Any extra arguments are silently ignored, just like the
first and the second argument are ignored in the third example.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk