This is the mail archive of the
mailing list for the libstdc++ project.
Re: [Patch] libstdc++/36338
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Chris Jefferson <chris at bubblescope dot net>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 30 May 2008 01:48:11 +0200
- Subject: Re: [Patch] libstdc++/36338
- References: <483EB744.firstname.lastname@example.org> <email@example.com>
I might be going mad but:Well, first I think we would see that when running the testsuite ;)
Second, more seriously, I don't think so: because the original sort_heap
was passing __last to pop_heap, which, in turn, was passing __last - 1
to __pop_heap. Eventually, in the sort_heap loop __last was decremented .
while (__last - __first > 1)Seeing as the original was a post-increment, shouldn't the --__last come after?
- std::pop_heap(__first, _RandomAccessIterator(__last--));
+ std::__pop_heap(__first, __last, __last);
In the new version, __last is decremented immediately, because this is
what __pop_heap wants, and we are done with it, the sort_heap iteration
is complete in the same way, __last decremented.
I think the two are completely equivalent.