小编N.Y*_*Y.C的帖子

为什么int[]不能转换为T*&?

template <class T>\nvoid func(T*& a)\n{\n\n}\n\nint main()\n{\n    int a[5];\n    func(a); // <-- Error here: no matching function for call to \xe2\x80\x98func(int [5])\xe2\x80\x99\n\n    return 0;\n}\n
Run Code Online (Sandbox Code Playgroud)\n

为什么int[]不隐式转换为int*以便可以匹配模板函数?

\n

c++ templates type-conversion

4
推荐指数
1
解决办法
102
查看次数

标签 统计

c++ ×1

templates ×1

type-conversion ×1