Just anonymous function would make a huge difference. Presently, you have to use boost or create new classes (Yes, you need to write a class for any anonymous function! (See Effective Stl, item 46 for more details of why it is recommended)).
void f(vector<Record>& v)
{
vector<int> indices(v.size());
int count = 0;
fill(indices.begin(),indices.end(),[&count](){ return ++count; });
// sort indices in the order determined by the name field of the records:
std::sort(indices.begin(), indices.end(), [&](int a, int b) { return v[a].name<v[b].name; });
// ...
}
There are function pointers in C and they are used to pass logic into C/C++ functions. They are not anonymous, and are more awkward to use than the new syntax, but they covered many use cases.
So, taken from: http://www2.research.att.com/~bs/C++0xFAQ.html#lambda
You could write something like: