]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/signals/example/print_sum_product.cpp
1 // Boost.Signals library
3 // Copyright Douglas Gregor 2001-2003. 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
11 #include <boost/signals/signal2.hpp>
14 void operator()(int x
, int y
) const { std::cout
<< x
+y
<< std::endl
; }
17 struct print_product
{
18 void operator()(int x
, int y
) const { std::cout
<< x
*y
<< std::endl
; }
24 boost::signal2
<void, int, int> sig
;
26 sig
.connect(print_sum());
27 sig
.connect(print_product());
29 sig(3, 5); // prints 8 and 15