有关容器的迭代器的有关问题

有关容器的迭代器的问题
for(vector<Book*>::iterator it=borrowedbook.begin();it!=borrowedbook.end();++it)
{
......
}
我的问题是,如果在循环中有erase的操作,例如borrowedbook.erase(it,it+1);那么,it会不会自动指向下一个元素???

------解决方案--------------------
探讨
for(vector<Book*>::iterator it=borrowedbook.begin();it!=borrowedbook.end();++it)
{
......
}
我的问题是,如果在循环中有erase的操作,例如borrowedbook.erase(it,it+1);那么,it会不会自动指向下一个元素???

------解决方案--------------------
erase的返回值:
A random access iterator pointing to the new location of the element that followed the last element erased by the function call, which is the vector end if the operation erased the last element in the sequence.

参考:
http://www.cplusplus.com/reference/stl/vector/erase/
------解决方案--------------------
楼主的写法要修改下,需要用返回值才行。
C/C++ code


for(vector<Book*>::iterator it=borrowedbook.begin();it!=borrowedbook.end();)
{
   if(需要删除)
      it = borrowedbook.erase(it,it+1);
   else
      ++it;
}