I am porting Macros, Xcodea / GCC 4.0 to Visual Studio 2005 with a medium-size C + project.
The difference I have made in one difference is to do with a map removing an element. In Visual Studio I can specify an element, which is specified by an Iterator and returns the Iterator to the position of the next element. This way, after erasing the iterator, it will not point to some invalid address.
In other words, I can do this in Visual Studio:
itor = m_ResourceMap.erase (itor);
In GCC 4.0, the deletion function is incorrect, so I can not do this. Does this mean that the following map elements have been shifted backwards, so the itater automatically indicates the next element, or does it mean that I have to increase the itater later? This is not very brief on this topic and XCode does not seem to have any
Thanks for your help,
Adrian
< Div class = "post-text" itemprop = "text">
no You must increase the itater before erasing. This way
m_ResourceMap.erase (it ++);
The erasure of the iterator has been canceled, so you can not extend it later.
Comments
Post a Comment