我有一个向量的迭代器传递给它的方法。 在这种方法中,我想一些元素加入到载体中,但我不知道是否只具有迭代STL向量,迭代器和插入(C++)
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
}
}
感谢 马库斯
感谢您的详细解答,绝对有帮助。 (只是在这种情况下,不幸的是界面不可更改) –