storing a pointer to a member function
<p>I'm wrapping an existing C API to make it easier to use in my VS2008 C++ program. The C API is expecting an array of "TABLE_ENTRY" structures that include a function pointer as in the code below. </p>

<p>But, I'm having difficulty storing a pointer to a member function in the function pointer.
Can anybody point out what I may be doing wrong?</p>

<p>Thanks,
PaulH</p>

<p>My code looks basically like this:</p>

<pre><code>struct TABLE_ENTRY; // forward decl

typedef int (WINAPI *MYPROC )(DWORD msg, TABLE_ENTRY* entry);

struct TABLE_ENTRY {
    const char* description;
    DWORD value;
    MYPROC callback;
};

class MyClass
{
public:
    MyClass() : description( "Some Description" ),
                some_value( 1 )
    {
    };

    int MyProc( DWORD msg, TABLE_ENTRY* my_entry )
    {
        return 0;
    };

    TABLE_ENTRY* operator*()
    {
        entry_.description = description.c_str();
        entry_.value = some_value;
        // error C2440: '=' : cannot convert from 'boost::_bi::bind_t&lt;R,F,L&gt;' to 'MYPROC'
        entry_.callback = boost::bind&lt; int &gt;( &amp;MyClass::MyProc, this );
        return &amp;entry_;
    };

    TABLE_ENTRY entry_;
    std::string description;
    DWORD some_value;
};

class MyClassCollection
{
public:
    TABLE_ENTRY* GetTable()
    {
        // is this okay or is it Evil &amp; wrong?
        return ( &amp;collection_.front() )-&gt;operator*();
    };

    void Add( MyClass&amp; my_class )
    {
        collection_.push_back( my_class );
    }
private:
    std::vector&lt; MyClass &gt; collection_;
};

int _tmain( int argc, _TCHAR* argv[] )
{
    MyClass class1;
    MyClass class2;

    MyClassCollection collection;
    collection.Add( class1 );
    collection.Add( class2 );

    TABLE_ENTRY* table = collection.GetTable();
    TABLE_ENTRY entry1 = table[ 0 ]; // should be class1's table
    TABLE_ENTRY entry2 = table[ 1 ]; // should be class2's table

    return 0;
}
</code></pre>
