]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/signals/example/no_function.cpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / signals / example / no_function.cpp
1 // Boost.Signals library
2
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)
7
8 // For more information, see http://www.boost.org
9
10 #include <iostream>
11 #include <boost/signals/signal2.hpp>
12 #include <string>
13 #include <functional>
14
15 void print_sum(int x, int y)
16 {
17 std::cout << "Sum = " << x+y << std::endl;
18 }
19
20 void print_product(int x, int y)
21 {
22 std::cout << "Product = " << x*y << std::endl;
23 }
24
25 void print_quotient(float x, float y)
26 {
27 std::cout << "Quotient = " << x/y << std::endl;
28 }
29
30 int main()
31 {
32 typedef boost::signal2<void, int, int, boost::last_value<void>,
33 std::string, std::less<std::string>,
34 void (*)(int, int)> sig_type;
35
36 sig_type sig;
37 sig.connect(&print_sum);
38 sig.connect(&print_product);
39
40 sig(3, 5); // print sum and product of 3 and 5
41
42 // should fail
43 // sig.connect(&print_quotient);
44 }