
25 Nov
2011
25 Nov
'11
9:55 p.m.
On 11/25/2011 09:09 PM, Vicente J. Botet Escriba wrote:
I was comparing it to
R f(TO& a, T1& b, T2& c, T3& d, A0 const& arg0, A1 const& arg1) { return arg1 * a + arg2 / b + sin(c) * cos(d); } //... R r = f(a,b,c,d,a0,a1);
Passing the variable in scope is useful for higher-order functions, that usually take a couple of arguments for the values operated on. You cannot pass extra args as arguments, short of having a partial evaluation mechanism. This is what function objects are for.