Changeset 23721 for lang/cplusplus
- Timestamp:
- 11/14/08 23:47:09 (5 years ago)
- Location:
- lang/cplusplus/i3/trunk/src
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/i3/trunk/src/Common.h
r23714 r23721 21 21 #include <libintl.h> 22 22 //#include <argtable2.h> 23 #ifdef MOL_OS_ unix23 #ifdef MOL_OS_UNIX 24 24 #include <popt.h> 25 25 #endif … … 143 143 #undef WINDOWS_SEH_EXCEPT 144 144 145 #ifdef MOL_OS_ unix145 #ifdef MOL_OS_UNIX 146 146 147 147 namespace i3 … … 333 333 334 334 #endif 335 -
lang/cplusplus/i3/trunk/src/Test2.cpp
r23617 r23721 10 10 #include <boost/preprocessor/seq/for_each.hpp> 11 11 12 # define CONFIG_NAMES (a)(b)(x)(y)12 #include <boost/preprocessor/control/if.hpp> 13 13 14 #define MACRO_DEFINE_MEMBERS(r, data, elem) uintptr_t elem; 14 int BOOST_PP_IF(10, a, b); // expands to a 15 int BOOST_PP_IF(0, c, d); // expands to b 16 17 //#define CONFIG_NAMES (a)(b)(x)(y) 18 //#define MACRO_DEFINE_MEMBERS(r, data, elem) uintptr_t elem; 19 20 #define pp_integer 0 21 #define pp_string 1 22 #define pp_integer_array 2 23 #define pp_string_array 3 24 25 #define CONFIG_NAMES (( \ 26 pp_integer , a ))(( \ 27 pp_string , b ))(( \ 28 pp_integer_array , x ))(( \ 29 pp_string_array , y ))(( \ 30 pp_integer , dummy )) 31 32 #define MACRO_DEFINE_MEMBERS(r, data, elem) \ 33 BOOST_PP_IF(BOOST_PP_EQUAL(BOOST_PP_TUPLE_ELEM(2, 0, elem), pp_integer) , int, \ 34 BOOST_PP_IF(BOOST_PP_EQUAL(BOOST_PP_TUPLE_ELEM(2, 0, elem), pp_string) , char*, \ 35 BOOST_PP_IF(BOOST_PP_EQUAL(BOOST_PP_TUPLE_ELEM(2, 0, elem), pp_integer_array) , int*, char**))) \ 36 BOOST_PP_TUPLE_ELEM(2, 1, elem); 37 38 #define MACRO_DEFINE_SIZE_MEMBERS(r, data, elem) \ 39 BOOST_PP_IF( \ 40 BOOST_PP_OR( \ 41 BOOST_PP_EQUAL(BOOST_PP_TUPLE_ELEM(2, 0, elem), pp_integer_array), \ 42 BOOST_PP_EQUAL(BOOST_PP_TUPLE_ELEM(2, 0, elem), pp_string_array ) \ 43 ) \ 44 , size_t BOOST_PP_TUPLE_ELEM(2, 1, elem);, ) 15 45 16 46 namespace i3 { 17 47 struct Config { 18 48 BOOST_PP_SEQ_FOR_EACH(MACRO_DEFINE_MEMBERS, data, CONFIG_NAMES) 49 }; 50 struct ConfigArrayLength { 51 BOOST_PP_SEQ_FOR_EACH(MACRO_DEFINE_SIZE_MEMBERS, data, CONFIG_NAMES) 19 52 }; 20 53 } … … 24 57 Config c; 25 58 c.a = 12345; 26 27 c.b = reinterpret_cast<decltype(c.b)>(&c); 28 29 BOOST_CHECK((Config*)(decltype(c.b))(&c) == &c); 59 char d = 'c'; 60 c.b = &d; 61 c.x = &c.a; 62 c.y = &c.b; 63 //c.b = reinterpret_cast<decltype(c.b)>(&c); 64 //BOOST_CHECK((Config*)(decltype(c.b))(&c) == &c); 30 65 31 66 using namespace std;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)