Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77883 - trunk/libs/scope_exit/test
From: lorcaminiti_at_[hidden]
Date: 2012-04-10 08:25:54


Author: lcaminiti
Date: 2012-04-10 08:25:53 EDT (Tue, 10 Apr 2012)
New Revision: 77883
URL: http://svn.boost.org/trac/boost/changeset/77883

Log:
Removed tpl param from same_line test.
Text files modified:
   trunk/libs/scope_exit/test/same_line.cpp | 2 +-
   trunk/libs/scope_exit/test/same_line_seq.cpp | 31 ++++++++++++++++++++++++-------
   2 files changed, 25 insertions(+), 8 deletions(-)

Modified: trunk/libs/scope_exit/test/same_line.cpp
==============================================================================
--- trunk/libs/scope_exit/test/same_line.cpp (original)
+++ trunk/libs/scope_exit/test/same_line.cpp 2012-04-10 08:25:53 EDT (Tue, 10 Apr 2012)
@@ -69,7 +69,7 @@
         SCOPE_EXIT_ALL_INC_DEC(x, delta) // Multiple scope exits on same line.
     }
     BOOST_TEST(x == 0);
-#endif // lambdas
+#endif // LAMBDAS
     
     return boost::report_errors();
 }

Modified: trunk/libs/scope_exit/test/same_line_seq.cpp
==============================================================================
--- trunk/libs/scope_exit/test/same_line_seq.cpp (original)
+++ trunk/libs/scope_exit/test/same_line_seq.cpp 2012-04-10 08:25:53 EDT (Tue, 10 Apr 2012)
@@ -12,28 +12,43 @@
 #include <boost/detail/lightweight_test.hpp>
 
 #define SCOPE_EXIT_INC_DEC(variable, offset) \
- BOOST_SCOPE_EXIT_ID( \
- BOOST_PP_CAT(inc, __LINE__) /* unique ID */, 0 /* no TPL */, \
+ BOOST_SCOPE_EXIT_ID(BOOST_PP_CAT(inc, __LINE__), /* unique ID */ \
             (&variable) (offset) ) { \
         variable += offset; \
     } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(inc, __LINE__)) \
     \
- BOOST_SCOPE_EXIT_ID( \
- BOOST_PP_CAT(dec, __LINE__) /* unique ID */, 0 /* no TPL */, \
+ BOOST_SCOPE_EXIT_ID(BOOST_PP_CAT(dec, __LINE__), \
+ (&variable) (offset) ) { \
+ variable -= offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(dec, __LINE__))
+
+#define SCOPE_EXIT_INC_DEC_TPL(variable, offset) \
+ BOOST_SCOPE_EXIT_ID_TPL(BOOST_PP_CAT(inc, __LINE__), \
+ (&variable) (offset) ) { \
+ variable += offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(inc, __LINE__)) \
+ \
+ BOOST_SCOPE_EXIT_ID_TPL(BOOST_PP_CAT(dec, __LINE__), \
             (&variable) (offset) ) { \
         variable -= offset; \
     } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(dec, __LINE__))
 
 #define SCOPE_EXIT_ALL_INC_DEC(variable, offset) \
- BOOST_SCOPE_EXIT_ALL_ID(BOOST_PP_CAT(inc, __LINE__) /* unique ID */, \
+ BOOST_SCOPE_EXIT_ALL_ID(BOOST_PP_CAT(inc, __LINE__), \
             (=) (&variable) ) { \
         variable += offset; \
     }; \
- BOOST_SCOPE_EXIT_ALL_ID(BOOST_PP_CAT(dec, __LINE__) /* unique ID */, \
+ BOOST_SCOPE_EXIT_ALL_ID(BOOST_PP_CAT(dec, __LINE__), \
             (=) (&variable) ) { \
         variable -= offset; \
     };
 
+template<typename T>
+void f(T& x, T& delta) {
+ SCOPE_EXIT_INC_DEC_TPL(x, delta)
+ BOOST_TEST(x == 0);
+}
+
 int main(void) {
     int x = 0, delta = 10;
 
@@ -42,12 +57,14 @@
     }
     BOOST_TEST(x == 0);
 
+ f(x, delta);
+
 #ifndef BOOST_NO_LAMBDAS
     {
         SCOPE_EXIT_ALL_INC_DEC(x, delta)
     }
     BOOST_TEST(x == 0);
-#endif // lambdas
+#endif // LAMBDAS
 
     return boost::report_errors();
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk