Boost logo

Boost Users :

From: Douglas Gregor (dgregor_at_[hidden])
Date: 2007-06-14 09:31:10


Hughes, James wrote:
> Hello all,
>
> I have a quick question that I hope some of the experts on Function and Bind can answer. I'll give a quick précis of what I would like to do.
>
> We have an event system in our code. I would like to set this up so that any particular event can be 'attached' to arbitrary classes and functions in those classes. For example, a "Print" Event may need to call an arbitrary function in an arbitrary class (or a number of these). Therefore the event server needs to have a list of all these class/function pairs for each event type.
>
Bind and Function were meant to work together to do this. See, for example:

  http://www.boost.org/libs/bind/bind.html#with_boost_function

Note that a "function" object can only target only thing. You can create
a container of "function" objects if you want to be able to call several
different things, or just use the Boost.Signals library which was
designed for this purpose.

  - Doug


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