views:

67

answers:

1

As the title might convey, I'm having problems seeing how Boost Bind, Boost Function, Boost Signals and C++ function pointers all play together.

From my understanding, Boost Bind and Boost Function in conjunction work like Signals while Signals is an abstraction above Bind and Function.

Also, compared to standard C++ function pointers, why is Boost Function/Bind preferable?

Hopefully you can help me clear up some of my confusion here. Basically I'm trying to find the best/easiest callback solution using C++. :)

+1  A: 

See here a discussion on the different concepts of c-function-pointers, boost function and boost signal.

Imho the main difference between the two boost function objects and c-function-pointers is the ability to add default parameters. This makes it easy to use methods (functions with a invisible first parameter -> the this pointer) as function objects. It is as well possible to adapt functions that require parameters to be used as function objects with different arguments.

Signal/Slot is a differnt thing: It allows you to publish a signal that clients can subscribe to. The signal can be seen as a list of function pointers. Clients can add their function pointers to the list. When the signal is called all function pointers in the list are informed/called.

David Feurle