How do I compare if two function objects hold the same function reference?
struct A {
void b(){}
}
int main() {
A a;
auto f1 = std::bind(&A::b, a);
auto f2 = std::bind(&A::b, a);
f1 == f2 // ???
}
How do I compare if two function objects hold the same function reference?
struct A {
void b(){}
}
int main() {
A a;
auto f1 = std::bind(&A::b, a);
auto f2 = std::bind(&A::b, a);
f1 == f2 // ???
}
Result of std::bind
guarantees only to be callable and to have member type result_type
. There is no standard-conformant way to compare binded functions.
Return value
A function object of unspecified type T, for which std::is_bind_expression::value == true, and which can be stored in std::function. The object is movable if f and all args are movable, and is copyable otherwise. The type defines the following members:
from http://en.cppreference.com/w/cpp/utility/functional/bind