BOOST_PP_CAT宏主要用来连接两个标识符。此宏被其它地方用到。
定义此宏的头文件boost\preprocessor\cat.hpp
# define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b)
# define BOOST_PP_CAT_I(a, b) BOOST_PP_CAT_II(~, a ## b)
# define BOOST_PP_CAT_II(p, res) res
为什么BOOST_PP_CAT宏要定义这么多辅助宏(BOOST_PP_CAT_I和BOOST_PP_CAT_II)呢?为什么不直接如下定义:
#define BOOST_PP_CAT_SIMPLE(a, b) a##b
原因是这两者之间是有细微的差别的。
请看下面的例子。
int AB = 512;