//函数调用 bind&function
void fun(){ CCLOG("Hello cocos"); return; } std::function<void()> f = std::bind(fun); fun();
-------------------
void fun1(){
int number = 8;
// auto fc = [&](int i){
auto fc = [=](int i)mutable{
number++;
return i+number;
};
cout<<fc(6);
}
//获得MenuItemFont得文件名
void SceneB:: onSelectFile(Ref *obj){ MenuItemFont *it1 = (MenuItemFont *) obj; Label *lable = (Label*)it1->getLabel(); CCLOG("%s",lable->getString().c_str() ); }
std::function<void(std::string)> f;//->函数对象
原文:http://www.cnblogs.com/fulizhi/p/3794554.html