C ++运算符编译错误

时间:2012-08-17 05:01:19

标签: c++ xcode operator-overloading llvm

我正在尝试编译一个在Xcode中使用OpenCV C ++代码的项目。

template<typename _Tp> inline MatND_<_Tp>& MatND_<_Tp>::operator = (const MatND& m)
{
    if( DataType<_Tp>::type == m.type() )
    {
        Mat::operator = (m);
        return *this;
    }
    if( DataType<_Tp>::depth == m.depth() )
    {
        return (*this = m.reshape(DataType<_Tp>::channels));
    }
    CV_DbgAssert(DataType<_Tp>::channels == m.channels());
    m.convertTo(*this, DataType<_Tp>::type);
    return *this;
}

这里给我一个编译错误“在没有对象参数的情况下调用非静态成员函数”在“Mat :: operator =(m);”

代码没有损坏,我验证了它here

另一个有趣的是,如果我选择编译器作为LLVM GCC 4.2,那么代码工作正常,但在使用Apple LLVM编译器3.2进行编译时出现此错误。我需要使用Apple LLVM编译器进行编译,因为使用GCC进行编译会产生其他问题。

这里有什么问题?

0 个答案:

没有答案