According the the C++ reference STL containers were fixed in C++11 standard to take constant iterator in the erase
methods. The following code would not compile in g++4.7 with c++0x
enabled.
#include <vector>
int main()
{
std::vector<int> vector;
vector.push_back(0);
std::vector<int>::const_iterator vectorItr = vector.begin();
vector.erase(vectorItr);
}
Obviously the new signatures were not implemented. Is there any information when this issue will be fixed? I could not find any respective information in the C++0x/C++11 Support in GCC article.
In HERE:
Section: 23.3.6
Description: Class template vector
Status: Partial
Comments: insert and erase members do not take const_iterator arguments (N2350).
For what it's worth: I've tested this against GCC 4.8.1 as well as GCC 4.9 (20130602 snapshot) just now, and the result is that 4.8.1 still has this problem (note that the promised C++11 compliance is related to the language core, not the standard library), but the 4.9 snapshot compiles it correctly.
So I guess it's fair to assume that GCC 4.9, once released, will handle this as specified by the Standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With