大佬教程收集整理的这篇文章主要介绍了c – 折叠表达式模板参数推断/替换失败,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#include<iostream> template <typename T> struct sum{ T value; template <typename ... Ts> sum(Ts&&...values) : value{(values + ...)}{}//error here }; int main() { sum s(2,3,4); }
@H_384_7@main.cpp: In function 'int main()': main.cpp:11:16: error: class template argument deduction Failed: sum s(2,4); ^ main.cpp:11:16: error: no matching function for call to 'sum(int,int,int)' main.cpp:7:5: note: candidate: template<class T,class ... Ts> sum(Ts&& ...)-> sum<T> sum(Ts&&...values) : value{(values + ...)}{} ^~~ main.cpp:7:5: note: template argument deduction/substitution Failed: main.cpp:11:16: note: Couldn't deduce template parameter 'T' sum s(2,4);
以上是大佬教程为你收集整理的c – 折叠表达式模板参数推断/替换失败全部内容,希望文章能够帮你解决c – 折叠表达式模板参数推断/替换失败所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。