简体   繁体   English

c++ 向量迭代器转换错误

[英]c++ vector iterator conversion error

little help guys im still a newbie at c++小伙子们,我还是 c++ 的新手

error: invalid conversion from 'VboVO* const* const' to 'VboVO**'

im getting this error when trying to compile.我在尝试编译时收到此错误。 here is the relevant parts of my code这是我的代码的相关部分

struct VboVO{..};
vector<VboVO*> m_vboVos;
vector<VboVO*>::iterator iVbovo;

for(iVbovo = m_vboVos.begin() ; iVbovo != m_vboVos.end(); ++iVbovo){
}

This is a guess这是一个猜测

You are probably trying to perform this loop in a const member function of some class, with m_vboVos as a member variable.您可能正在尝试在某些 class 的const成员 function 中执行此循环,并将m_vboVos作为成员变量。 Therefore m_vboVos is const , and you cannot use an iterator with a const vector .因此m_vboVosconst ,您不能将iteratorconst vector一起使用。 Use const_iterator instead.改用const_iterator

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM