logo
  • 教程列表
  • SO官方文档
  • std 函数包装任何可调用的元素
    • 简单的用法
    • 与 stdbind 一起使用的 stdfunction
    • 使用 lambda 和 stdbind 进行 stdfunction
    • 功能开销
    • 将 stdfunction 绑定到不同的可调用类型
    • 在 stdtuple 中存储函数参数
  1. StackOverflow 文档
  2. C++ 教程
  3. std 函数包装任何可调用的元素
  4. 简单的用法

简单的用法

Created: November-22, 2018

#include <iostream>
#include <functional>
std::function<void(int , const std::string&)> myFuncObj;
void theFunc(int i, const std::string& s)
{
    std::cout << s << ": " << i << std::endl;
}
int main(int argc, char *argv[])
{
    myFuncObj = theFunc;
    myFuncObj(10, "hello world");
}
  • 与 stdbind 一起使用的 stdfunction
  • std 函数包装任何可调用的元素

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明