Creating a functor inside a member function without taking the class as an argument
Apologies for cryptographic decryption.
I want to create a functor of the following type:
const boost::function<bool ()>& functor
Please consider the class:
#include <boost/function.hpp>
class X {
public:
bool foo();
void bar() ;
};
void X::bar() {
const boost::function<bool (X *)>& f = &X::foo;
}
bool X::foo() {
std::cout << __func__ << " " << __LINE__ << " " << std::endl;
return true;
}
I have:
const boost::function<bool (X *)>& f = &X::foo;
Is it possible something like
const boost::function<bool ()>& f = &X::foo;
with boost :: bind or something else?
thank
+3
source to share