C++ 无法转换';常数T*';至';T*&&';

C++ 无法转换';常数T*';至';T*&&';,c++,c++11,C++,C++11,我在尝试将对象引用添加到指针向量时遇到错误: 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){

我在尝试将对象引用添加到指针向量时遇到错误:

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
}
模板Tmodel ransac::执行拟合(常数std::向量和数据){
std::向量也包含向量;
用于(常数自动和pnt:数据){

如果(fit_point(pnt,may_be_model)将
pnt
捕获为
const auto&
,但随后尝试将其推入包含非常量指针的向量中。这违反了const正确性


如果您不打算修改那些指针对象,请将
也\u inlines
更改为
std::vector
,如果需要修改,请通过
auto&
进行捕获。

您将
pnt
捕获为
const auto&
,但随后尝试将其推入包含非常量指针的向量中。这违反了const-正确性


如果您不打算修改那些指针对象,请将
也\u inlines
更改为
std::vector
,如果需要修改,请通过
auto&
捕获。

std::vector
的声明中缺少一个
const
。它应该是
std::vector
。您缺少一个
co>nst
在您的
std::vector
声明中。它应该是
std::vector