Comparing std::functions for equality?
问题 How can I compare two C++11 std::function s with operator== , and return true if both of said function s refer to the same function pointer? 回答1: operator== for std::function compares a std::function with a null pointer, as far as I can tell the standard does not provide any details as to why. Although, this boost FAQ entry, Why can't I compare boost::function objects with operator== or operator!=? provides a rationale and as far as I can tell should be applicable to std::function as well.