Boost logo

Boost :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-03-12 16:45:05


Hi,

I wish to use boost::bind to simply wrap a member function pointer. I'm
passing a member function into a slot in the Boost.Signals library, and I
would like the convenience of not having to specify the number of arguments
each member function has in boost.bind. For example, assume I have the
following class:

class Foo
{
public:
    void Function1( int ) {}
    void Function2( int, int, bool ) {}
};

I would like to be able to do the following:

Foo myFoo;
boost::bind( &Foo::Function1, myFoo );

In the case above, I now have an object bound to my function pointer,
however I am required to explicitly place a _1, _2, _3 (etc) depending on
how many parameters the member function takes. Is there a way that this can
be automated? Thanks.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk