| 1 | #include <boost/scope_exit.hpp>
|
|---|
| 2 |
|
|---|
| 3 | #define SHOW_ERROR
|
|---|
| 4 |
|
|---|
| 5 | #ifdef SHOW_ERROR
|
|---|
| 6 | template< typename the_argument_type>
|
|---|
| 7 | inline the_argument_type do_exit_scope( the_argument_type the_argument_value) {
|
|---|
| 8 | int value = 0;
|
|---|
| 9 |
|
|---|
| 10 | BOOST_SCOPE_EXIT( ( &value)) {
|
|---|
| 11 | value = 123;
|
|---|
| 12 | } BOOST_SCOPE_EXIT_END;
|
|---|
| 13 |
|
|---|
| 14 | return the_argument_value;
|
|---|
| 15 | }
|
|---|
| 16 | #else
|
|---|
| 17 | inline int do_exit_scope( int the_argument_value) {
|
|---|
| 18 | int value = 0;
|
|---|
| 19 |
|
|---|
| 20 | BOOST_SCOPE_EXIT( ( &value)) {
|
|---|
| 21 | value = 123;
|
|---|
| 22 | } BOOST_SCOPE_EXIT_END;
|
|---|
| 23 |
|
|---|
| 24 | return the_argument_value;
|
|---|
| 25 | }
|
|---|
| 26 | #endif
|
|---|
| 27 |
|
|---|
| 28 | int main( int argc, char **argv) {
|
|---|
| 29 | return 0;
|
|---|
| 30 | }
|
|---|