今天遇到了一个函数重载的问题
typedef struct _CvRect CvRect
{
int x,y,height,widht;
}
在windows下的代码
inline bool operator < (const CvRect& lhs, const CvRect & rhs)
{
return lhs.width * lhs.height < rhs.width * rhs.height;
}
编译是没有问题的。
在linux 下编译则提示错误 linux error no match for 'operator
将上述代码改为
inline bool operator < (const CvRect& lhs, const CvRect & rhs)
{
return lhs.width * lhs.height < rhs.width * rhs.height;
}就没有问题了
改动的地方是将对输入参数增加了const 限定