加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

C“延迟”模板参数

发布时间:2020-12-16 09:27:24 所属栏目:百科 来源:网络整理
导读:有没有直接的方法来做到以下几点: template class struct f {};template class F void function() { Fint(); //for example // ? F template int();}function f (); 我通过使用模板结构的额外类来解决方法. 我想知道是否有可能直接这样做. 谢谢 解决方法 模
有没有直接的方法来做到以下几点:

template < class >
struct f {};

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

function < f >();

我通过使用模板结构的额外类来解决方法.
我想知道是否有可能直接这样做.

谢谢

解决方法

模板模板参数的正确语法如下

template < class > struct f {}; 

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

...     
function < f >()

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读