我有以下类声明:
class DepthDescriptor
{
public:
DepthDescriptor(DepthType depth);
bool operator==(DepthDescriptor& type);
bool operator>=(DepthDescriptor& type);
bool operator<=(DepthDescriptor& type);
...
}
为什么以下行不执行到DepthDescriptor对象的隐式转换以便可以进行运算符比较?
if (depth == Depth_8U)
{
...
}
请注意,它depth是一个DepthDescriptor对象,DepthType是一个枚举,并且Depth_8U是枚举值之一。我希望像上面这样的行会首先调用隐式构造函数DepthDescriptor(DepthType depth),然后调用适当的运算符,但我得到no operator "==" matches these operands.