This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: deque fails to meet 23.2.1.3.4-5 causing invalid iterators and extra assignments
- From: Steve LoBasso <slobasso at yahoo dot com>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Fri, 26 Jan 2007 21:50:37 -0800 (PST)
- Subject: Re: deque fails to meet 23.2.1.3.4-5 causing invalid iterators and extra assignments
> >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