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]