开发者

C++ "delayed" template argument

开发者 https://www.devze.com 2022-12-28 15:55 出处:网络
Is there direct way to do the following: template < class > stru开发者_开发技巧ct f {}; template < class F >

Is there direct way to do the following:

template < class >
stru开发者_开发技巧ct f {};

template < class F >
void function() {
    F<int>();  //for example
    // ? F template <int>();
}

function < f >();

I have workaround by using extra class around template struct. I am wondering if it's possible to do so directly.

Thanks


The proper syntax for template template-parameters is as follows

template < class > struct f {}; 

template < template <class> class F > 
void function() { 
    F<int>();  //for example 
} 

...     
function < f >()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号