I think it is a big limitation of how C++ handles function pointers and std::function, that it is currently impossible to compare two arbitrary functions of different type in an elegant way.
I am now wondering if C++17 will change that with the introduction of std::any
void foo(int a) {}
int bar(float b) {}
void main()
{
std::any oneFoo = std::make_any(foo);
std::any oneBar = std::make_any(bar);
std::any anotherFoo = std::make_any(foo);
bool shouldBeFalse = (oneBar == oneFoo);
bool shouldBeTrue = (oneFoo == anotherFoo);
}
Is this gonna behave the way I expect it ?