This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR67085 move comparison functions in heap operations


This turns lots and lots of copies into moves, which can make a huge
difference to performance (consider a std::function which has to
allocate on every copy).

	PR libstdc++/67085
	* include/bits/stl_heap.h (push_heap, __adjust_heap, __pop_heap)
	(pop_heap, __make_heap, make_heap, __sort_heap, sort_heap): Use
	_GLIBCXX_MOVE when passing comparison function to other functions.
	(is_heap_until, is_heap): Use std::move when passing comparison
	function.
	* testsuite/23_containers/priority_queue/67085.cc: New test.

Tested powerpc64le-linux, committed to trunk.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]