“ ##”的含义是什么?在C ++宏中? [英] What's the meaning of "##" in a C++ macro?
本文介绍了“ ##”的含义是什么?在C ++宏中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的 ##是什么意思?
What's the meaning of "##" in the following?
#define CC_SYNTHESIZE(varType, varName, funName)\
protected: varType varName;\
public: inline varType get##funName(void) const { return varName; }\
public: inline void set##funName(varType var){ varName = var; }
推荐答案
运算符##连接两个参数,不留空白它们之间的空格:
例如
The operator ## concatenates two arguments leaving no blank spaces between them: e.g.
#define glue(a,b) a ## b
glue(c,out) << "test";
这也将转换为:
cout << "test";
这篇关于“ ##”的含义是什么?在C ++宏中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文