]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/signals/example/no_function.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>
15 void print_sum(int x
, int y
)
17 std::cout
<< "Sum = " << x
+y
<< std::endl
;
20 void print_product(int x
, int y
)
22 std::cout
<< "Product = " << x
*y
<< std::endl
;
25 void print_quotient(float x
, float y
)
27 std::cout
<< "Quotient = " << x
/y
<< std::endl
;
32 typedef boost::signal2
<void, int, int, boost::last_value
<void>,
33 std::string
, std::less
<std::string
>,
34 void (*)(int, int)> sig_type
;
37 sig
.connect(&print_sum
);
38 sig
.connect(&print_product
);
40 sig(3, 5); // print sum and product of 3 and 5
43 // sig.connect(&print_quotient);