I'm reading C++ Primer (5th edition) and in 9.9.3 it mentions inserting in-range elements.
It is clearly stated in the book that it will cause a runtime error if the range of the copy is the same as the target container.
// it'll cause a runtime error
vec.insert(vec.cbegin(), vec.cbegin(), vec.cend());
But it works in my computer, Why?
Aucun commentaire:
Enregistrer un commentaire