函数返回时——引发了异常: 读取访问权限冲突。 **_Right** 是 0x25。

由于代码太长,附上部分代码,问题是函数执行完返回就出现异常

//主程序代码
    int k = 2;
    int attempts = 3;
    vector<Point2d> initializeClusterCenter(k);
    vector<vector<Point>> fittingPointSet(k);
    vector<vector<Point>> divisionPointSet;

    divisionPointSet = pMinAreaRect(srcImg, points, showImg);

    initializeClusterCenter = meanValueClassify(divisionPointSet, k);
    fittingPointSet = MaxMinDisFun(points, initializeClusterCenter, attempts, k);

//函数代码
vector<vector<Point>> MaxMinDisFun(vector<Point> points, vector<Point2d> initializeClusterCenter, int attempts, int clusterNum)
{
    assert(attempts >= 0);
    assert(clusterNum > 0);

    vector<vector<Point>> cluster_pointSet(clusterNum);//聚类中心对应的点集

    constexpr float epsilon = 1;
    int dataNum = points.size(); //输入的样本数
    vector<Point2d> mean_values(clusterNum);
    vector<Point2d> former_clusterCenter(clusterNum);//上一步迭代的聚类中心
    vector<Point2d> latter_clusterCenter(clusterNum);//当前的聚类中心

......


https://blog.csdn.net/cxy19931018/article/details/80737026

你这样只给出部分代码似乎看不出来什么问题呀,一般出现访问冲突都是访问了已经释放的内存,可以使用vs单步调试找到具体冲突位置的。

Point类应该是没有重载“=”或者拷贝构造函数造成的