Custom sort function, error C2276: "&": illegal operation on bound member function expression

The solution: add static, declared as static function (or global function)

I is defined within the class: 

//按x坐标从小到大排序函数  
static bool sortFun(const cv::Point2d &p1, const cv::Point2d &p2);
//自定义排序函数  
bool CX::sortFun(const cv::Point2d &p1, const cv::Point2d &p2)
{
	return p1.x < p2.x;//升序排列  
}

 transfer:

sort(input_corners.begin() + index, input_corners.begin() + index + m_boardWidth, sortFun);

 

Guess you like

Origin blog.csdn.net/zfjBIT/article/details/93201832