C++ 宏“如果定义了类"

2022-01-11 00:00:00 macros c++ c-preprocessor

C++ 中是否有这样的宏(交叉编译器或特定于编译器):

Is there such macro in C++ (cross-compiler or compiler-specific):

#if isclass(NameSpace::MyClass)

会有用的.

推荐答案

如果你不关心可移植性,__if_exists 语句满足您的需求.

If you do not care about portability, the __if_exists statement in VC++ meets your needs.

相关文章