首页 > 其他 > 详细

default argument given of parameter 的问题

时间:2014-09-19 10:11:15      阅读:169      评论:0      收藏:0      [点我收藏+]

今天写了一个类,其中的一个方法用到了默认参数,结果报了  “default argument given of parameter 的问题 ” 错误。

类头文件的声明如下:

void train(std::vector<std::vector<double> >& trainSet, std::vector<int>& labels, const std::string model, double lrate, 
	std::vector<double>& w , double& b, int maxiter, double delt = 0.0000001 );


实现代码如下:

<pre name="code" class="cpp">void perceptron::train(std::vector<std::vector<double> >& trainSet, std::vector<int>& labels, const std::string model, double lrate, 
	std::vector<double>& w , double& b, int maxiter, double delt=0.000001  )
{
	
           ....

}


经上网查询才知,带有默认值参数的函数,在实现的时候,参数上是不能有值的

应该将实现代码中的默认参数去掉,如下

void perceptron::train(std::vector<std::vector<double> >& trainSet, std::vector<int>& labels, const std::string model, double lrate, 
	std::vector<double>& w , double& b, int maxiter, double delt  )
{
	
           ....

}

此时,就没有这个错误了。  记录一下。


default argument given of parameter 的问题

原文:http://blog.csdn.net/chenlei0630/article/details/39393731

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!