VS2008 Vector使用有关问题
VS2008 Vector使用问题求助!
有如下定义:
其中bone是一个类
vecoor<bone> bonevec;
vector<bone>::iterator theIterator;
bone *pbone = 0;
接下来两处代码出错:
(1)theIterator=0;
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
(2)for (theIterator = bonevec.begin(); theIterator != bonevec.end();
theIterator++)
{
pbone = theIterator;
}
error C2440: '=' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'bone *'
1> with
1> [
1> _Ty=bone,
1> _Alloc=std::allocator<bone>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
在VC6下编译没有问题啊,该怎么解决?求大家指点迷津啊!
------解决方案--------------------
我不得不承认,VC6就是个神器!
有如下定义:
其中bone是一个类
vecoor<bone> bonevec;
vector<bone>::iterator theIterator;
bone *pbone = 0;
接下来两处代码出错:
(1)theIterator=0;
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
(2)for (theIterator = bonevec.begin(); theIterator != bonevec.end();
theIterator++)
{
pbone = theIterator;
}
error C2440: '=' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'bone *'
1> with
1> [
1> _Ty=bone,
1> _Alloc=std::allocator<bone>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
在VC6下编译没有问题啊,该怎么解决?求大家指点迷津啊!
------解决方案--------------------
我不得不承认,VC6就是个神器!