1 | #include <boost/signals2.hpp>
|
---|
2 | #include <boost/phoenix/core.hpp>
|
---|
3 | #include <boost/phoenix/bind.hpp>
|
---|
4 | #include <boost/phoenix/operator.hpp>
|
---|
5 | #include <iostream>
|
---|
6 |
|
---|
7 | using boost::phoenix::bind;
|
---|
8 | using boost::phoenix::arg_names::arg1;
|
---|
9 |
|
---|
10 | typedef boost::signals2::signal< bool (int& param)> signal_type;
|
---|
11 |
|
---|
12 | bool foo(int& p)
|
---|
13 | {
|
---|
14 | p *= 2;
|
---|
15 | return true;
|
---|
16 | }
|
---|
17 |
|
---|
18 | int main()
|
---|
19 | {
|
---|
20 | signal_type sig;
|
---|
21 |
|
---|
22 | //sig.connect(foo);
|
---|
23 | sig.connect(bind(foo,arg1));
|
---|
24 |
|
---|
25 | int a = 5;
|
---|
26 | std::cout << sig(a) << " " << a << std::endl;
|
---|
27 |
|
---|
28 | return 0;
|
---|
29 | }
|
---|
30 |
|
---|