为什么下面的代码不工作?宏定义为类型不起作用
// Template function definition
template <typename T>
void apply(const T& input);
// Helper macro definition
#define APPLY_FUNCTION(PIXELTYPE) \
apply<##PIXELTYPE>(input);
// Use macro to call function
APPLY_FUNCTION(uint8_t);
这产生以下错误:
Error: pasting "<" and "uint8_t" does not give a valid preprocessing token
即使你修复了宏,你在哪里获得'输入'传递给函数? – NathanOliver
宏不以分号结尾。 –
不是说你错了,而是在你的宏里面有'input'似乎不是你可以选择的最佳做法。 –