【发布时间】:2017-04-12 20:32:46
【问题描述】:
将参数打包到函数指针中的语法是什么?
我希望能够对函数指针进行 typedef,但是当我执行此类操作时编译器会报错
template< class ...Args >
struct method { typedef typename void(*type)(void*, Args...); };
带有类似error: expected nested-name-specifier before 'void'的消息
【问题讨论】:
-
见鬼,对不起伙计们。我从编译器中误读了一个错误,上面写着
error: need 'typename' before ...,但我把它放在结构中而不是对依赖类型的引用:/
标签: c++ c++11 templates function-pointers variadic-templates