Boost logo

Boost :

From: Greg Dehaas (GregDehaas_at_[hidden])
Date: 2002-12-13 07:21:24


Firstly, thanks in advance to any/all help

I'm trying to use the boost::function class on object members
(not just the class - but to a bound object)

So far, I've got something like this:

-------- CODE -----------------------------------------------
#include <boost/function.hpp>
#include <functional>

//Simple Class
class CSimple
{
public:
        void SimpleMethod()
        {
                printf("Simple Method Called\n");
        }
};

//Entry point
void main()
{
        boost::function<void> oSimpleMethod;

        oSimpleMethod =
std::bind1st(std::mem_fun(&CSimple::SimpleMethod),&oSimple);

        oSimpleMethod();
}
-------- END OF CODE -----------------------------------------------

I'm getting the following 2 errors:
c:\program files\microsoft visual studio\vc98\include\functional(155) :
error C2039: 'second_argument_type' : is not a member of
'mem_fun_t<void,class CSimple>'
        C:\Dev\Console\main.cpp(32) : see reference to class template
instantiation 'std::binder1st<class std::mem_fun_t<void,class CSimple> >'
being compiled
c:\program files\microsoft visual studio\vc98\include\functional(155) :
error C2065: 'second_argument_type' : undeclared identifier
        C:\Dev\Console\main.cpp(32) : see reference to class template
instantiation 'std::binder1st<class std::mem_fun_t<void,class CSimple> >'
being compiled

Now it seems like it's to do with the way I'm trying to use std:bind1st
(which I've never used before)
However, the boost documentation shows examples doing exactly what I'm
doing!?!

Can anyone spot the mistake?

Greg

PS: I'm using VC++ 6


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