V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
shylockhg
V2EX  ›  问与答

变长模板参数同时匹配失败和匹配到空参数列表<>如何解决

  •  1
     
  •   shylockhg · 2020-08-19 13:49:56 +08:00 · 804 次点击
    这是一个创建于 1317 天前的主题,其中的信息可能已经有所发展或是发生改变。
    note: candidate function [with T = Type, V = Type, $2 = void]
    
    note: candidate function [with T = Type, V = Type, Vs = <>, $3 = void]
    

    如上所示 T 是 template, V 是 typename, Vs 是 typename...,如果用 func<T1, T2>的方式调用模板函数,会同时匹配到两个。。

    有大佬知道是什么问题么

    第 1 条附言  ·  2020-08-19 17:39:33 +08:00
    函数签名
    ```cpp
    template <template <typename> class T, typename V, typename... Vs, typename = void>
    func(Expr* expr, V v, Vs&... vs)
    template <template <typename> class T, typename V, typename = void>
    func(Expr* expr, V& vs)
    ```
    2 条回复    2020-08-19 17:39:55 +08:00
    MarshallMathers
        1
    MarshallMathers  
       2020-08-19 15:01:02 +08:00
    没有具体代码吗?
    shylockhg
        2
    shylockhg  
    OP
       2020-08-19 17:39:55 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3235 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 13:58 · PVG 21:58 · LAX 06:58 · JFK 09:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.