|
Boost : |
Subject: Re: [boost] [signals2] extended_slot_type bug with preferred syntax
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-11-06 10:22:15
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 06 November 2008 03:11 am, Franz Alt wrote:
> have you got some examples with the usage of the extended_slot_type /
> connect_extended? In your documentation there is no example.
Attached is an example program.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFJEwuq5vihyNWuA4URAkBpAKCoJo5GTm6MPc27FjsBBvx5OqjORgCfXx9i
oL5Hbtr/v4NMjinkLWlosUk=
=fETt
-----END PGP SIGNATURE-----
--Boundary-00=_quwEJRz9s4aeJx+
Content-Type: text/x-c++src; charset="iso-8859-1";
name="connect_extended_example.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="connect_extended_example.cpp"
#include <boost/signals2/signal.hpp>
#include <iostream>
void self_disconnecting_slot(const boost::signals2::connection &conn)
{
std::cout << __FUNCTION__ << std::endl;
conn.disconnect();
}
int main()
{
typedef boost::signals2::signal0<void> signal_type;
typedef signal_type::extended_slot_type slot_type;
signal_type sig;
slot_type myslot(&self_disconnecting_slot);
sig.connect_extended(myslot);
std::cout << sig.num_slots() << " slots connected.\n";
sig();
std::cout << sig.num_slots() << " slots connected.\n";
sig();
return 0;
}
--Boundary-00=_quwEJRz9s4aeJx+--
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk