小编Gon*_*per的帖子

可变参数模板中的函数参数

是否可以编写一个带有函数作为模板参数的可变参数模板类?

这些是有效的c ++声明

template <typename ...Types> class foo;

template <int func(int)>  class bar;
Run Code Online (Sandbox Code Playgroud)

是否可以做类似的事情

template <int func(int)...> class foobar; 
Run Code Online (Sandbox Code Playgroud)

我尝试了很多不同的语法

template <int ...func(int)> class foobar; 
Run Code Online (Sandbox Code Playgroud)

并没有编译(我使用gcc 8.1.0与-std = c ++ 17)

c++ c++17

2
推荐指数
1
解决办法
78
查看次数

标签 统计

c++ ×1

c++17 ×1