GENERATED_BODY()函数是什么?

发布时间 2023-09-25 23:54:54作者: 2086nmj

会发现它是一个宏定义

// Include a redundant semicolon at the end of the generated code block, so that intellisense parsers can start parsing
// a new declaration if the line number/generated code is out of date.
#define GENERATED_BODY_LEGACY(...) BODY_MACRO_COMBINE(CURRENT_FILE_ID,_,__LINE__,_GENERATED_BODY_LEGACY);
#define GENERATED_BODY(...) BODY_MACRO_COMBINE(CURRENT_FILE_ID,_,__LINE__,_GENERATED_BODY);

那么问题来了,BODY_MACRO_COMBINE又在哪里呢?像是在套娃似的。。

它的目的是为了给当前的类生成一些东西。。

参考1:https://zhuanlan.zhihu.com/p/483857843