|
Boost Users : |
From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2006-10-02 07:55:34
Johan Torp wrote:
> I often tend to have interfaces which take a boost::function<void()>
> that is to be called when an event occurs. Quite often I need make two
> separate function calls as response to one event. In these cases I
> usually solve the problem using the following technique:
>
> void foo();
> void bar();
>
> void call_two(const boost::function<void ()>& one, const
> boost::function<void ()>& two)
> { one(); two(); }
>
> boost::function<void ()> on_event = boost::bind(&call_two,
> boost::bind(&foo), boost::bind(&bar));
#include <boost/lambda/bind.hpp>
boost::function<void ()> on_event = (boost::lambda::bind(&foo),
boost::lambda::bind(&bar));
// Johan (Nilsson)
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