Using Boost::Bind and Boost::Function for Windows Procedure Functions

The experiment failed. What was I thinking? I forgot that C++ member functions have an implicit this pointer, that makes them pretty useless as function pointers. Oh well… Onto finding a good thunking library … Who woulda thunk?

Advertisements

2 Responses to Using Boost::Bind and Boost::Function for Windows Procedure Functions

  1. Ash says:

    Try this:

    class X
    {
    public:
    int f(double);
    };

    X myX;

    boost::function fun = boost::bind(boost::mem_fn(&X::f), &myX);

    int result = fun(9.33); // will call myX.f(9.33);

  2. Ash says:

    wordpress massacred the template arguments of boost::function! Oh well…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: