C++ macro “if class is defined”

前端 未结 5 1926
孤独总比滥情好
孤独总比滥情好 2020-12-19 01:59

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

#if isclass(NameSpace::MyClass)

Would be useful.

5条回答
  •  天命终不由人
    2020-12-19 02:11

    There is no such thing at the preprocessing stage, so no macro.

    However you can have a look at the is_class type traits available in Boost or in C++0x that enable you to take decisions at compile time.

提交回复
热议问题