Hi All!
Is there any way to compare 2 boost::function<objects?
boost::function has no operator==() for comparing boost::function<>.
Is there any hack way? I need to do the following:
struct A
{
void f(int) {};
};
struct B
{
void f(int) {};
};
int main()
{
A a;
B b;
boost::function< void (int) f1(boost::bind(&A::f, &a, _1));
boost::function< void (int) f2(boost::bind(&B::f, &b, _1));
boost::function< void (int) f3(boost::bind(&B::f, &b, _1));
// This works well:
std::cout<< ((f2 == boost::bind(&B::f, &b, _1)) ? "equal" : "not
equal" )<<std::endl;
// This doesn't compile...
std::cout<< ((f1 == f2) ? "equal" : "not equal" )<<std::endl;
};
Any ideas?
WBR, Sectoid.