构建[OpenSubdiv](http://graphics.pixar.com/opensubdiv/docs/cmake_build.html)时遇到以下错误:

error C2666: 'OpenSubdiv::v3_0_0_beta::Vtr::internal::StackBuffer<TYPE,SIZE>::operator []' : 4 overloads have similar conversions


触发错误的代码行是:

            for (int i = 0; i < pVertEdges.size(); ++i) {
            cVertEdgeBuffer[i] = _refinement.getEdgeChildEdges(pVertEdges[i])[pVertInEdge[i]];
        }


实例是:

internal::StackBuffer<Index,16> cVertEdgeBuffer(_childLevel._maxValence);


在StackBuffer类中的重载运算符[]中似乎有些含糊

template <typename TYPE, unsigned int SIZE>
class StackBuffer
{
StackBuffer();
StackBuffer(size_type size);
~StackBuffer();

public:
TYPE &       operator[](size_type index)        { return _data[index]; }
TYPE const & operator[](size_type index) const  { return _data[index]; }

operator TYPE const * () const { return _data; }
operator TYPE *       ()       { return _data; }
};


我将编译从VS2012更改为VS2010,但错误仍然出现。

此错误是由于OpenSubdiv的来源还是由于我的Cmake配置引起的?我按照OpenSubdiv的要求添加所有依赖项。

最佳答案

此问题已在OpenSubdiv(dev-branch)中修复
https://github.com/PixarAnimationStudios/OpenSubdiv/issues/622#issuecomment-111051840

10-08 00:14