【问题标题】:c++ concatenate macro1 text with comma and with macro2c ++用逗号和macro2连接macro1文本
【发布时间】:2020-03-23 20:09:50
【问题描述】:

来自这些宏:

#define X abc
#define Y def

如何定义宏 Z,其内容为:

abc,def

?

我无法管理

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/punctuation/comma.hpp>
#define ZZ BOOST_PP_CAT(X,BOOST_PP_COMMA)

这只会产生:

abcBOOST_PP_COMMA

【问题讨论】:

  • 你不需要连接任何东西,因为, 是一个单独的标记。 #define Z X,Y 应该足够了。

标签: c++ boost-preprocessor


【解决方案1】:

你可以简单地写:

X,Y

这样就可以了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-02
    • 2011-01-01
    • 2011-11-04
    • 1970-01-01
    • 2018-01-29
    • 1970-01-01
    相关资源
    最近更新 更多