How to implement callbacks?

Hi,

I don't know if callbacks is the right term. Basically, I implemented a red-black tree data structure and I want to make a GUI application with animated insertion, deletion, traversal, etc. So every time an event happens (node is inserted or rotated or visited or its color changes) I want to send a message to the GUI to trigger an animation.

What's the best way of doing this without re-implementing the entire tree and doing GUI things in the tree itself?
You may pass a function object as the callback. See:

http://www.cplusplus.com/reference/functional/function/?kw=function

You may use bind for member functions. See:

http://www.cplusplus.com/reference/functional/bind/
Topic archived. No new replies allowed.