]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/signals/test/dead_slot_test.cpp
1 // Boost.Signals library
3 // Copyright (C) Douglas Gregor 2001-2006. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org
10 #include <boost/test/minimal.hpp>
11 #include <boost/signal.hpp>
12 #include <boost/bind.hpp>
14 typedef boost::signal1
<int, int> sig_type
;
16 class with_constant
: public boost::BOOST_SIGNALS_NAMESPACE::trackable
{
18 with_constant(int c
) : constant(c
) {}
20 int add(int i
) { return i
+ constant
; }
26 void do_delayed_connect(with_constant
* wc
,
28 sig_type::slot_type slot
)
30 // Should invalidate the slot, so that we cannot connect to it
33 boost::BOOST_SIGNALS_NAMESPACE::connection c
= sig
.connect(slot
);
34 BOOST_CHECK(!c
.connected());
37 int test_main(int, char*[])
40 with_constant
* wc1
= new with_constant(7);
42 do_delayed_connect(wc1
, s1
, boost::bind(&with_constant::add
, wc1
, _1
));