我是靠谱客的博主 超帅薯片,这篇文章主要介绍std::bind 用法,现在分享给大家,希望可以做个参考。

#include <string>
#include <functional>
#include <iostream>
using namespace std;

class Worker
{
public:
	static Worker* Get()
	{
		static Worker ff;
		return &ff;
	}

	string Process(string& data)
	{
		printf("%sn", data.c_str());
		return "welcom";
	}
private:
	Worker();
	~Worker();
};

Worker::Worker()
{
}

Worker::~Worker()
{
}

int main()
{
	string data("hello world");	
	auto f = std::bind(&Worker::Process, Worker::Get(), std::placeholders::_1);    
	cout<<f(data)<<endl;	
	return 0;
}

 

最后

以上就是超帅薯片最近收集整理的关于std::bind 用法的全部内容,更多相关std::bind内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(118)

评论列表共有 0 条评论

立即
投稿
返回
顶部