Boost logo

Boost Users :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2008-03-01 14:52:02


On Sat, Mar 1, 2008 at 7:10 AM, QbProg <tholag_at_[hidden]> wrote:
> >
> > FunctionOne = make_slot_selector( &Implementor::ImplOne , i );
> >
> > But I haven't had time to try it yet :-) I was going to try to do one
> > last push this weekend to get this lib submitted for review, maybe as
> > a part of that effort I can give this a whirl.
> >
> It would be really usefoul to have something like that :)
>
> Thank you
> QbProg
>

OK, I have it. Here is a little snippet of usage:

class sum
{
public:
    sum(int base)
        : m_base(base)
    {}

    int add1(int num) const
    { return m_base + num; }

    int add2(int num1, int num2) const
    { return m_base + num1 + num2; }

private:
    int m_base;
};

...

boost::function<int(int)> fun1 = bind_mem_fn(&sum::add1, test_sum);
boost::function<int(int, int)> fun2 = bind_mem_fn(&sum::add2, test_sum);

complete example/test file (tested with GCC 4.0.1, using recent svn
boost trunk):
http://dancinghacker.com/code/dataflow/dataflow/utility/bind_mem_fn.html

I think you only need the following two files:
http://svn.boost.org/svn/boost/sandbox/SOC/2007/signals/boost/dataflow/utility/bind_mem_fn.hpp
http://svn.boost.org/svn/boost/sandbox/SOC/2007/signals/boost/dataflow/utility/member_function_signature.hpp

I'd appreciate it if you could let me know whether it works for
you/what platform.

Cheers,

Stjepan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net