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

  • 關於本站
  • 免責聲明