Is there a way to avoid the use of boost::bind to attach a member function to a boost::signal slot?
The only way I can get it to work is to use bind like this:
mysignal.connect(boost::bind(&myClass::listenerMember, this, _1, _2));
but I really want it to look more like this:
mysignal.connect(myClass::listenerMember);
Here is some sample code to show it a bit better:
#include <iostream>
#include <cstdlib>
#include "boost/signals2.hpp"
class window
{
public:
boost::signals2::signal<void(int,int)> sigLButtonDown;
void simulateCallback(){ sigLButtonDown(1,3);}
};
class windowListener
{
public:
windowListener(window * pwindow) { pwindow->sigLButtonDown.connect(boost::bind(&windowListener::listenerMember, this, _1, _2));}
void listenerMember(int x, int y) { std::cout << "ping!" << std::endl;}
};
int main()
{
window w;
windowListener l(&w);
std::cout << "Here goes!" << std::endl;
w.simulateCallback();
}