简体   繁体   English

没有匹配的功能 - c ++

[英]No matching function - c++

I have the following constructor: 我有以下构造函数:

RegMatrix(int numRow, int numCol, std::vector<double> fill);

and inside one of my functions: 在我的一个功能中:

RegMatrix RegMatrix::operator+(RegMatrix &matrix)

I create: 我创造:

std::vector<ThreeDigits> fill;

and then I return: 然后我回来:

return RegMatrix(1,2,fill);

and it says I return (int,int,std::vector<ThreeDigits>&) ... 它说我返回(int,int,std::vector<ThreeDigits>&) ...
Why is that and how can I fix it? 为什么这样,我该如何解决?

std::vector<double> is not the same type as std::vector<ThreeDigits> . std::vector<double>std::vector<ThreeDigits> You can fix this problem by either creating RegMatrix::RegMatrix(int, int, const std::vector<ThreeDigits>&) , or by modifying the declaration of fill : std::vector<double> fill; 您可以通过创建RegMatrix::RegMatrix(int, int, const std::vector<ThreeDigits>&)或修改fillstd::vector<double> fill;的声明来解决此问题std::vector<double> fill; .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM