Ticket #6202: test.cpp

File test.cpp, 550 bytes (added by freddie@…, 11 years ago)

Sample program.

Line 
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
7using boost::phoenix::bind;
8using boost::phoenix::arg_names::arg1;
9
10typedef boost::signals2::signal< bool (int& param)> signal_type;
11
12bool foo(int& p)
13{
14 p *= 2;
15 return true;
16}
17
18int 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