【发布时间】:2012-01-05 12:35:38
【问题描述】:
我有一个传递向量迭代器的方法。 在这种方法中,我想在向量中添加一些元素,但我不确定当只有迭代器时这是否可行
void GUIComponentText::AddAttributes(vector<GUIComponentAttribute*>::iterator begin, vector<GUIComponentAttribute*>::iterator end)
{
for (vector<GUIComponentAttribute*>::iterator i = begin; i != end; ++i)
{
GUIComponentAttribute &attrib = *(*i);
// Here are the GUIComponentAttribute objects analyzed - if an object of a
// special kind appears, I would like to add some elements to the vector
}
}
谢谢 马库斯
【问题讨论】: