Sorry, but you’re wrong here. Cppreference clearly says

Invalidates iterators and references at or after the point of the erase, 
including the end() <https://en.cppreference.com/w/cpp/container/vector/end> 
iterator.

https://en.cppreference.com/w/cpp/container/vector/erase 
<https://en.cppreference.com/w/cpp/container/vector/erase>

It says nothing about invalidating references before the point of insertion

I expect QVector/QList behave exactly like that (if it is not shared like in 
the example in the first mail).

I’d rather prefer not to read another 10 blog posts «how not to shoot in the 
leg with Qt6 QList»

Ivan

> 1 сент. 2020 г., в 19:31, Thiago Macieira <thiago.macie...@intel.com> 
> написал(а):
> 
> On Tuesday, 1 September 2020 09:05:48 PDT NIkolai Marchenko wrote:
>> Wait what? The switch to Qt6 was supposed to become a painless process yet
>> you're introducing important and hard to notice in real code changes that
>> can result in undefined behaviour?
>> What? WHAT?!
> 
> There's no violation. Your code was incorrect in the past, it just happened 
> to 
> work.
> 
> Assume any and all non-const function will invalidate iterators.
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel DPG Cloud Engineering
> 
> 
> 
> _______________________________________________
> Development mailing list
> Development@qt-project.org
> https://lists.qt-project.org/listinfo/development

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to