Boost logo

Boost Users :

From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-06-18 14:20:56


--- In Boost-Users_at_y..., Mark Storer <mstorer_at_c...> wrote:
> This has little to do with boost (which, again, is why I can
answer; at
> least in part)
>
> A member function cannot be addressed like a regular function. Ask
yourself
> this question: With just a function pointer to go by, what will the
> compiler use for 'this'?
>
> The Good News: STL contains a template functor to take care of this
for you:
> "std::mem_fun". I haven't messed with it personally, but the docs
sure make
> it sound like it would do the trick.
>
> The Bad News: I'm not so sure the thread class will let you use
it.
>
> I'm not familiar with the function0<> template, so I don't know
whether or
> not std::mem_fun will work with boost::thread.

Any function object that takes no parameters and returns void will
work here. This includes std::mem_fun. I might suggest boost::bind
instead, though. It's a little more flexible then the adapters
provided by the standard.

Bill Kempf


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