My confusion is similar to this code:
#include "stdafx.h"
#include <boost/bind.hpp>
using namespace std;
void fool(std::string s)
{
std::cout<<s<<endl;
}
void fool2()
{
std::cout<<"test2 called\n"<<endl;
}
void fool3(std::string s1,std::string s2)
{
std::cout<<"test3 called\n"<<endl;
}
typedef boost::function<void(std::string)> myHandler;
void mywait(myHandler handler)
{
handler("hello my wait");
}
int main()
{
mywait(boost::bind(fool,_1));
mywait(boost::bind(fool2));
return 0;
}
the following link is the same question.
http://forums.opensuse.org/english/development/programming-scripting/441878-how-can-boost-bind-swallow-argument-member-function.html
I just read the article: [How the Bost Bind library can improve your C ++ programs] and speeding up the bind document
they just say it works, but I don’t know why. I'm still confused.
Sorry about my poor English. I have clearly explained.
source
share