【发布时间】:2012-02-09 13:21:10
【问题描述】:
我的头文件中有以下减速
// 3D Vector
typedef struct tagV3D /*: V2D*/ {
union {
struct {
double x;
double y;
double z;
};
struct {
struct tagV2D v2d_;
};
};
} V3D, TVec3D, *PVec3D;
现在我的 cpp 文件中有一个方法
bool InsertSelfIntersectionVertexes(vector<PVec3D> &avtxlst) {
PVec3D vtx;
int iI;
...
vtx = new TVec3D;
*vtx = v;
PVec3D* p= avtxlst.begin() + iI + 1;
avtxlst.insert(p, vtx);
...
}
我在尝试编译代码时遇到以下错误
error C2440: 'initializing' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'PVec3D *'
和error C2664: 'std::_Vector_iterator<_Ty,_Alloc> std::vector<_Ty>::insert(std::_Vector_const_iterator<_Ty,_Alloc>,const _Ty &)' : cannot convert parameter 1 from 'PVec3D' to 'std::_Vector_const_iterator<_Ty,_Alloc>'
我该如何解决这个问题?
以下代码在 vc6 上运行良好,并且在迁移到 VS 2008 时出现错误。
这是为什么呢?
感谢任何答案
【问题讨论】:
-
为什么 *PVec3D 不是 PVec3D,即没有星号?
标签: visual-studio-2008 visual-c++ vector