[PATCH] PR67085 move comparison functions in heap operations

Jonathan Wakely jwakely@redhat.com
Thu Jan 19 20:25:00 GMT 2017


On 19/01/17 18:50 +0000, Jonathan Wakely wrote:
>On 19/01/17 18:28 +0000, Jonathan Wakely wrote:
>>@@ -397,7 +401,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>      while (__last - __first > 1)
>>	{
>>	  --__last;
>>-	  std::__pop_heap(__first, __last, __last, __comp);
>>+	  std::__pop_heap(__first, __last, __last, _GLIBCXX_MOVE(__comp));
>
>Oops, we can't move from the functor in a loop, it might be invalid
>after the first move. Fix coming asap.

Unfortunately this adds some more copies to my testcase. I have
another idea how to avoid that though.

This also adds an extra (safe) move in __is_heap.

Tested powerpc64le-linux, committed to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3729 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20170119/f41479ac/attachment.bin>


More information about the Libstdc++ mailing list