Ticket #9363: phoenix_non_const_ref.cpp
| File phoenix_non_const_ref.cpp, 338 bytes (added by , 9 years ago) |
|---|
| Line | |
|---|---|
| 1 | #include <boost/ref.hpp> |
| 2 | #include <boost/phoenix.hpp> |
| 3 | |
| 4 | struct my_func |
| 5 | { |
| 6 | typedef void result_type; |
| 7 | |
| 8 | void operator() (int& n) const |
| 9 | { |
| 10 | ++n; |
| 11 | } |
| 12 | }; |
| 13 | |
| 14 | void foo(int& n) |
| 15 | { |
| 16 | my_func f; |
| 17 | boost::phoenix::bind(f, boost::phoenix::placeholders::_1)(n); |
| 18 | } |
| 19 | |
| 20 | int main(int, char*[]) |
| 21 | { |
| 22 | int n = 0; |
| 23 | foo(n); |
| 24 | return n; |
| 25 | } |
