#include <iostream>
#include <boost/bind.hpp>
#include <boost/function.hpp>
using namespace std;
class People
{
public:
People(const string& name)
:_name(name)
{
}
void SaySomething(const string& msg) const
{
cout<<_name<<" said: "<< msg << endl;
}
private:
string _name;
};
void RunSomethingforName(const string& name, boost::function<void(const People&)> f)
{
People p(name);
f(p);
}
int main(int argc, char* argv[])
{
RunSomethingforName("Mike", boost::bind(&People::SaySomething, _1,"fuck"));
return 0;
}
example for bind
最新推荐文章于 2021-12-26 22:01:48 发布