$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [signals] Chaining signals
From: Nat Goodspeed (nat_at_[hidden])
Date: 2009-03-13 13:33:10
Remko Tronçon wrote:
> Is it possible to 'chain' boost signals? I.e., connect signal a to
> signal b, such that whenever signal a fires, all slots of signal b are
> called.
#include <boost/signals.hpp>
#include <boost/bind.hpp>
#include <iostream>
void gotit()
{
std::cout << "Received the signal\n";
}
int main(int argc, char *argv[])
{
typedef boost::signal<void()> signal_type;
signal_type first;
signal_type second;
first.connect(boost::bind(boost::ref(second)));
second.connect(boost::bind(gotit));
first();
return 0;
}