基础C++ functional

  函数对象:可以定义函数对象。

sort(this->sprites.begin(), this->sprites.end(), [](const struct SpriteInfo & s1, const struct SpriteInfo & s2) {
return s1.priority > s2.priority;
}); typedef function<void (string &)> callback;
void func(string &data)
{
data = "YES";
cout << data << endl;
}
void callee(string &data, callback call)
{
call(data);
}
int main()
{
string data;
//callback call = &(func);
//callee(data, call);
callback call = [] (string data) { cout << "YES" << endl; };
call(data);
return ;
}

functional

上一篇:ASP.NET MVC显示UserControl控件(扩展篇)


下一篇:[No0000111]java9环境变量配置bat