[Bug libstdc++/67085] priority queue should not copy comparators when calling push_heap and pop_heap

konig121 at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 31 19:16:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67085

Andrew Calcutt <konig121 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Calcutt <konig121 at gmail dot com> ---
The current implementation of push and company likely need to be updated to
specify that the comparator be passed by reference explicitly. For Example:

Before:
 std::push_heap(c.begin(), c.end(), comp);

After:
 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
 std::push_heap<_Sequence::iterator,_Comp_ref>(c.begin(), c.end(), comp);



More information about the Gcc-bugs mailing list