我正在构建QList<QList<double>> *以下方式,以在函数中返回randomPoint():
QList<QList<double>> *solverMethod::randomPoint(double* bottom_, double* top_, int items_)
{
QList<QList<double>> *lstPt_ = new QList<QList<double>>;
for(int i=0;i<items_;i++)
{
QList<double> pt_;
lstPt_->append(pt_);
for(int j=0;j<m_ndim;j++)
{
pt_.append(TRandom::rand(bottom_[j],top_[j]));
}
}
return lstPt_;
}
但是在 for 循环之后有一个停止点,我注意到它pt_被正确填充(m_ndim元素),而lstPt由item_empty组成QList<double>。怎么了?