0
我試圖對象的引用添加到指針的矢量面對錯誤:從VS.NET 2013無法將「常量T *」到「T * &&」
template <class Tpoint, class Tmodel> Tmodel ransac<Tpoint, Tmodel>::perform_fitting(const std::vector<Tpoint>& data){
std::vector<Tpoint*> also_inliers;
for (const auto& pnt : data){
if (fit_point(pnt, may_be_model) <= t){
also_inliers.push_back(&pnt); //error here
}
} // ! for range
}
錯誤消息:
錯誤88錯誤C2664: '無效的std ::矢量> ::的push_back(CV :: Point_ * const的&)':不能從轉換參數1 'const的CV :: Point_ *' 到 「CV :: Point_ * & &'
您在'std :: vector'聲明中缺少'const'。它應該是'std :: vector'。 –