Ticket #10793: BOOST_SCOPE_EXIT.cpp
| File BOOST_SCOPE_EXIT.cpp, 298 bytes (added by , 8 years ago) |
|---|
| Line | |
|---|---|
| 1 | #include <cstdlib> |
| 2 | #include <iostream> |
| 3 | #include <boost/scope_exit.hpp> |
| 4 | |
| 5 | int main(int argc, char* argv[]) { |
| 6 | double var = 0.0; |
| 7 | |
| 8 | { |
| 9 | BOOST_SCOPE_EXIT(&var, argc) { |
| 10 | var = argc; |
| 11 | } BOOST_SCOPE_EXIT_END |
| 12 | |
| 13 | var = 10.0; |
| 14 | } |
| 15 | |
| 16 | std::cout << var << std::endl; |
| 17 | |
| 18 | return EXIT_SUCCESS; |
| 19 | } |
