报错如下:
stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<std::vector<std::vector<cv::Point_<int> > >, cv::Size_<int> >*, std::vector<std::pair<std::vector<std::vector<cv::Point_<int> > >, cv::Size_<int> > > >; _Tp = std::pair<std::vector<std::vector<cv::Point_<int> > >, cv::Size_<int> >; _Compare = bool (*)(std::pair<std::vector<std::vector<cv::Point_<int> > >, cv::Size_<int> >&, std::pair<std::vector<std::vector<cv::Point_<int> > >, cv::Size_<int> >&)]’:
经过勘察,最后定位结果如下:
sort(cluster_copy.begin(), cluster_copy.end(), region_cmp);
中使用了region_cmp
用来比较:
bool region_cmp(CLUSTER_ELEM &e1, CLUSTER_ELEM &e2)
{
return (e1.second.width > e2.second.width);
}
应改为:
bool region_cmp(CLUSTER_ELEM const &e1, CLUSTER_ELEM const &e2)
{
return (e1.second.width > e2.second.width);
}
原因未知,查看StackOverflow才知道的;