<分区>
我见过这样的代码:
#define A // macro
A void foo(bar); // function declaration
还有这个:
#define B // macro
class B foo { // class declaration
bar
};
在那里使用宏是什么意思?
呃...我的意思是我不明白语法。我以前没见过这个。
其实我只是在opencv3.1的features2d.hpp
中找到了这种代码。
class CV_EXPORTS_W BOWImgDescriptorExtractor {
...
CV_WRAP void setVocabulary( const Mat& vocabulary );
...
}
在cvdef.h中
#if (defined WIN32 || defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined CVAPI_EXPORTS
# define CV_EXPORTS __declspec(dllexport)
#elif defined __GNUC__ && __GNUC__ >= 4
# define CV_EXPORTS __attribute__ ((visibility ("default")))
#else
# define CV_EXPORTS
#endif
/* special informative macros for wrapper generators */
#define CV_EXPORTS_W CV_EXPORTS
#define CV_WRAP
这里,CV_EXPORTS_W 和 CV_WRAP 是宏。我在 C++ 中没有看到这种语法。