您的位置:首页 > 其它

回调 两种不同的使用方式

2018-03-20 08:31 218 查看
#include <functional>
#include <iostream>
// one method
using callback = std::function<void()>;
// another method
//typedef std::function<void()> callback;
void f1()
{
    std::cout << "a" << std::endl;

}
void call(callback f)
{
    f();

}
int main(int argc,char** argv)
{
    callback c1 = std::bind(&f1);

    call(c1);

    return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐