function objects—— 行为像函数的对象,即一个类重载了()运算符,可以像函数一样用括号和传入参数,如
class PrintInt {
public:
void operator() (int elem) const {
cout << elem << ' ';
}
};
for_each (coll.begin(), coll.end(), //range
PrintInt()); //operation