Boost logo

Boost :

From: Russell Hind (rhind_at_[hidden])
Date: 2004-01-23 03:30:34

Edward Diener wrote:
> if (ACallback == boost::bind(&X::AMemberFunction,&x))
> {
> // Do something
> }
> else if (ACallback == boost::bind(&Y::AnotherMemberFunction,&y))
> {
> // Do something else
> }

I have wanted this for a while, and ended up with my own
MethodCallback_c class which just stored an object pointer and method
address, and allowed compares. I had an interface class to it, so they
could be stored generically, but have now replaced this with function<>
in places where I don't need comparisons. If boost::function now has ==
then I can stop using the interface class, and just use function<> but
assign my MethodCallback_c<> class to it rather than a bind if bind
doesn't support ==.

But agree with your reasoning that if bind is to be the c++ equivelant
of closures (borland speak) then it should have this capability. I do
use this test on __closures in VCL classes and find it useful.



Boost list run by bdawes at, gregod at, cpdaniel at, john at