I have 2 functions f()
and g()
. I want to call them in order every time. Can I get a boost::function
to do this?
E.g. something like:
boost::function functor = boost::bind( boost::bind(f), boost::bind(g) );
Extend this further, say it takes arguments, then what I need is a chain of responsibility. Each node does something with arguments, then followed by next node of chain. How do I do that?
Update Thanks for Seth Carnegie's comments.
I think what I really want is how to construct a chain of responsibility into a single boost::function
, each node of chain can be constructed by using boost::bind()
.
Have you considered using boost::signal ?
With boost::signal you can connect multiple function calls into one.