[Bug libstdc++/95245] std::sort copies custom comparator

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 20 21:08:50 GMT 2020


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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
[algorithms.requirements] paragraph 10 says:

[Note: Unless otherwise specified, algorithms that take function objects as
arguments are permitted to copy those function objects freely. Programmers for
whom object identity is important should consider using a wrapper class that
points to a noncopied implementation object such as reference_wrapper<T> 
20.14.5), or some equivalent solution. — end note]


More information about the Gcc-bugs mailing list