Hello,
I am trying to use Boost::Bind to bind my function but I am getting an error as Bind cannot diffrentiate between the constructors
even though they have diffrent function signatures.
TestBind(boost::bind((&Test::process), &t1, _1));
I would highly appreciate any help.
Thanks
//Boost Includes
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
namespace test{
struct A{
public:
int one;
int two;
};
struct B{
public:
short three;
short four;
};
typedef boost::shared_ptr<A> t_boostInt;
typedef boost::shared_ptr<B> t_boostShort;
class TestBind{
public:
typedef boost::function<
int (t_boostInt)> t_ProcessFunctionInt;
public:
///< call back process function for short
typedef boost::function<
short (t_boostShort)> t_ProcessFunctionShort;
public:
TestBind( t_ProcessFunctionInt func){}
TestBind(t_ProcessFunctionShort func){}
};
class Test
{
public:
Test(){}
~Test();
public:
int process(t_boostInt msg) {
return 1;}
};
int main(int argc, char * argv[])
{
try {
Test t1;
TestBind(boost::bind((&Test::process), &t1, _1));
}
catch (std::exception & exception) {
std::cout << exception.what() << std::endl;
}
return 0;
}
}