: .
++ 0x lambdas , , . , Increment /. ++.
struct Increment {
int & arg;
Increment (int a) : arg (a) {}
void operator () (int & i)
{arg += i;}
};
void foo (const std :: vector <int> & buffer, int x)
{
std :: for_each (
buffer .begin (), buffer .end (),
Increment (x));
std :: for_each (
buffer .begin (), buffer .end (),
[&x] (int & i) {x += i;});
}
, , std::function ( C ).
, , , , . Lambdas ++ 0x, Increment . ( , , , , , - nitpicking, , , , Javascript).
?