Boost Preprocessor is so cool

来源:互联网 发布:centos 主流版本 编辑:程序博客网 时间:2024/05/22 01:48
#include "boost/preprocessor/seq/size.hpp"#include "boost/preprocessor/seq/elem.hpp"#include "boost/preprocessor/seq/push_back.hpp"#include "boost/preprocessor/stringize.hpp"#include "boost/preprocessor/iteration/local.hpp"#include "boost/preprocessor/arithmetic/add.hpp"#include "boost/preprocessor/arithmetic/div.hpp"#include "boost/preprocessor/arithmetic/mul.hpp"#include "boost/preprocessor/arithmetic/dec.hpp"#include "boost/preprocessor/arithmetic/mod.hpp"#include "boost/preprocessor/debug/assert.hpp"#include "boost/preprocessor/comparison/equal.hpp"#define SEQ_DIM 4#define SEQ0 (a)(b)(c)(d) \             (a1)(b1)(c1)(d1)BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(BOOST_PP_MOD(BOOST_PP_SEQ_SIZE(SEQ0), SEQ_DIM), 0), \"#error SEQ has to be aligned with 4")#define BOOST_PP_LOCAL_MACRO(n) printf("%s %s %s %s\n", \BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(BOOST_PP_ADD(BOOST_PP_MUL(n, SEQ_DIM), 0), SEQ0)), \BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(BOOST_PP_ADD(BOOST_PP_MUL(n, SEQ_DIM), 1), SEQ0)), \BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(BOOST_PP_ADD(BOOST_PP_MUL(n, SEQ_DIM), 2), SEQ0)), \BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(BOOST_PP_ADD(BOOST_PP_MUL(n, SEQ_DIM), 3), SEQ0)));#define BOOST_PP_LOCAL_LIMITS (0, BOOST_PP_DEC(BOOST_PP_DIV(BOOST_PP_SEQ_SIZE(SEQ0), SEQ_DIM)))#include BOOST_PP_LOCAL_ITERATE()

0 0
原创粉丝点击