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