Ticket #4325: test_function.cpp
| File test_function.cpp, 336 bytes (added by , 12 years ago) |
|---|
| Line | |
|---|---|
| 1 | #include <boost/function.hpp> |
| 2 | #include <boost/ref.hpp> |
| 3 | |
| 4 | #include <iostream> |
| 5 | |
| 6 | struct Myfun |
| 7 | { |
| 8 | void operator()(void) {} |
| 9 | }; |
| 10 | |
| 11 | int main(int argc, char *argv[]) |
| 12 | { |
| 13 | Myfun f; |
| 14 | |
| 15 | boost::function<void (void)> f1(boost::ref(f)); |
| 16 | boost::function<void (void)> f2 = f1; |
| 17 | |
| 18 | std::cout << f2.target<Myfun>() << std::endl; |
| 19 | |
| 20 | return 0; |
| 21 | } |
