deque fails to meet 23.2.1.3.4-5 causing invalid iterators and extra assignments

Steve LoBasso slobasso@yahoo.com
Sat Jan 27 05:50:00 GMT 2007


> >BTW I believe this problem also exists in the single parameter version of erase.
> >
> >erase(iterator)
> >
> Please provide a detailed analysis, possibly a testcase: of course, when 
> I fixed the other overload I suspected that, but I failed to find values 
> of size() and __position leading to similar problems.>
>
> Thanks,
> Paolo.

I'm sorry, you are correct. It avoids the problem by not subtracting n which happens to be 1, thus producing the correct effect.

It would probably a lot more clear to compare number of elements before the range to elements after the range. These off-by-one errors would be a lot more clear.

   -Steve




 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html



More information about the Libstdc++ mailing list