开发者

vector and iterators

I have a vector that defined like below

vector<Field&g开发者_运维技巧t; m_vField;

I fill the vector by this command:

 AddFiled(const Field& aiField)
 {
   m_vField.push_back(aiField);
 }

But when I try to run iterator the vector this crashed after first iteration by "Access violation reading location"

vector<Field>::iterator it;
for(it = m_vField.begin(); it != m_vField.end() ; it++)
{
   dosomthing
}

Thanks for your help.


Think you have named the variable wrongly. Isnt the vector m_vField, whereas you have usedvField in your loop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜