Hello, I have a problem using boost::bind (version 1.34.1). I don't know whot I make wrong but I think that I can use it in my case. Or I'm wrong? I use VS2005. in some external header file I have the declaration typedef void (* FUNCTION)(int ,void *); void SetCallback(FUNCTION cb); Now I want to call a function inside my class. Maybe with bind? I have tested the following: SetCallback(boost::bind<void>(boost::mem_fn(&Program::OnCallback),this,_1,_2)); but this does not work..have anyone an hint how I can do that? Regards Hansjörg
I have a problem using boost::bind (version 1.34.1). I don't know whot I make wrong but I think that I can use it in my case. Or I'm wrong?
I use VS2005.
in some external header file I have the declaration
typedef void (* FUNCTION)(int ,void *);
try with
typedef boost::function
void SetCallback(FUNCTION cb);
Now I want to call a function inside my class. Maybe with bind?
I have tested the following:
SetCallback(boost::bind<void>(boost::mem_fn(&Program::OnCallback),this,_1,_
2));
but this does not work..have anyone an hint how I can do that?
B/Rgds Max
Max schrieb:
in some external header file I have the declaration
typedef void (* FUNCTION)(int ,void *);
try with typedef boost::function
FUNCTION; void SetCallback(FUNCTION cb);
I can't change this definition because it is in an header of an external library...Is there another way? Regards Hansjörg
Hi, I admit, I deliberately waited, hoping for someone to give a different answer, but I am afraid there is no way to use bind here. boost::bind creates a functor, not a function. I have similar situation when using expat. I use another function as delegator. Not nice, but it works. See http://lists.boost.org/boost-users/2009/02/44615.php Regards, Roland Hansi wrote:
Max schrieb:
in some external header file I have the declaration
typedef void (* FUNCTION)(int ,void *);
try with typedef boost::function
FUNCTION; void SetCallback(FUNCTION cb);
I can't change this definition because it is in an header of an external library...Is there another way?
Regards Hansjörg
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Hansi
-
Max
-
Roland Bock