有没有直接的方法来做到以下几点:
template < class >
struct f {};
template < class F >
void function() {
F<int>(); //for example
// ? F template <int>();
}
function < f >();
Run Code Online (Sandbox Code Playgroud)
我通过使用模板结构的额外类来解决方法.我想知道是否有可能直接这样做.
谢谢
模板模板参数的正确语法如下
template < class > struct f {};
template < template <class> class F >
void function() {
F<int>(); //for example
}
...
function < f >()
Run Code Online (Sandbox Code Playgroud)