Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65743 - in sandbox/variadic_macro_data: boost/variadic_macro_data/detail libs/variadic_macro_data/test
From: eldiener_at_[hidden]
Date: 2010-10-03 19:19:24


Author: eldiener
Date: 2010-10-03 19:19:20 EDT (Sun, 03 Oct 2010)
New Revision: 65743
URL: http://svn.boost.org/trac/boost/changeset/65743

Log:
Updated VMD_DATA_ELEM macro to work with VC++ and expanded data test.
Text files modified:
   sandbox/variadic_macro_data/boost/variadic_macro_data/detail/VMDDetail.hpp | 8 ++++++++
   sandbox/variadic_macro_data/libs/variadic_macro_data/test/TestData.cpp | 17 +++++++++++++++++
   2 files changed, 25 insertions(+), 0 deletions(-)

Modified: sandbox/variadic_macro_data/boost/variadic_macro_data/detail/VMDDetail.hpp
==============================================================================
--- sandbox/variadic_macro_data/boost/variadic_macro_data/detail/VMDDetail.hpp (original)
+++ sandbox/variadic_macro_data/boost/variadic_macro_data/detail/VMDDetail.hpp 2010-10-03 19:19:20 EDT (Sun, 03 Oct 2010)
@@ -12,6 +12,8 @@
 #include <boost/preprocessor/tuple/rem.hpp>
 #if defined(BOOST_MSVC)
 #include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/facilities/empty.hpp>
 #endif
 
 #define VMD_DETAIL_DATA_ELEM_0(p0, ...) p0
@@ -126,9 +128,15 @@
 /**/
 #define VMD_DETAIL_CAT(a, ...) VMD_DETAIL_PRIMITIVE_CAT(a, __VA_ARGS__)
 #define VMD_DETAIL_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
+#if defined(BOOST_MSVC)
+#define VMD_DETAIL_DATA_ELEM(n,...) \
+ BOOST_PP_CAT(VMD_DETAIL_CAT(VMD_DETAIL_DATA_ELEM_, n)(__VA_ARGS__,),BOOST_PP_EMPTY()) \
+/**/
+#else
 #define VMD_DETAIL_DATA_ELEM(n,...) \
   VMD_DETAIL_CAT(VMD_DETAIL_DATA_ELEM_, n)(__VA_ARGS__,) \
 /**/
+#endif
 #define VMD_DETAIL_DATA_TO_PP_ARRAY(...) \
   ( VMD_DETAIL_DATA_SIZE(__VA_ARGS__) , VMD_DETAIL_DATA_TO_PP_TUPLE(__VA_ARGS__)) \
 /**/

Modified: sandbox/variadic_macro_data/libs/variadic_macro_data/test/TestData.cpp
==============================================================================
--- sandbox/variadic_macro_data/libs/variadic_macro_data/test/TestData.cpp (original)
+++ sandbox/variadic_macro_data/libs/variadic_macro_data/test/TestData.cpp 2010-10-03 19:19:20 EDT (Sun, 03 Oct 2010)
@@ -2,16 +2,33 @@
 #include <boost/detail/lightweight_test.hpp>
 #include <vector>
 #include <boost/type_traits/is_same.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
 
 int main()
   {
   
 #if !defined(BOOST_NO_VARIADIC_MACROS)
 
+ #define VMD_TEST_THE_DATA 657,1298,the,*,we99,33,++,jjgg,+=
+
+ int mSize(VMD_DATA_SIZE(VMD_TEST_THE_DATA));
+
+ BOOST_TEST_EQ(mSize,9);
+
+ mSize VMD_DATA_ELEM(8,VMD_TEST_THE_DATA) 5;
+
+ BOOST_TEST_EQ(mSize,14);
+
   int aSize(VMD_DATA_SIZE(23,ll,678,456));
   
   BOOST_TEST_EQ(aSize,4);
   
+ aSize += mSize VMD_DATA_ELEM(3,VMD_TEST_THE_DATA) VMD_DATA_SIZE(VMD_TEST_THE_DATA);
+
+ BOOST_TEST_EQ(aSize,130);
+
+ BOOST_TEST_EQ(BOOST_PP_INC(VMD_DATA_ELEM(5,VMD_TEST_THE_DATA)),34);
+
   int anElement(VMD_DATA_ELEM(2,23,ll,678,456));
   
   BOOST_TEST_EQ(anElement,678);


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