Improve insert/emplace robustness to self insertion

Jonathan Wakely jwakely@redhat.com
Wed Jun 29 21:55:00 GMT 2016


On 29/06/16 21:43 +0200, François Dumont wrote:
>I tried those changes too but started having failing tests in 
>vector/ext_pointer so prefer to not touch that for the moment. I think 
>the compilation error was coming from the change of begin() + 
>(__position - cbegin()) into begin() + __n because of overloaded 
>operator+. The 2 other changes should be fine for a future patch.

By the way, I fixed that in my patch too. The problem was that __n had
type size_type, but for adding to iterators it should really be
difference_type. Simply using auto makes it work :-)

Unless you see any problems in my patch I'll finish testing it
tomorrow and commit it with your new testcases.

Thanks for inspiring me to investigate what we were doing wrong! :-)





More information about the Libstdc++ mailing list