Based on the information from Stack at the following link, this is possible, but only if you complete the std :: function object in your class.
std :: vector from std :: function
Using the wrapper class, you can check if the two wrapped pointers of std :: function are equal, but that says nothing about what the std :: function wraps. Thus, a design change is probably the best approach.
edit: I came back to show how I solved a very similar problem.
0) Typedefs for short.
using std::placeholders; typedef std::function < void ( int, float ) > some_func; typedef std::pair < intptr_t, intptr_t > method_hash;
Write your collection of std :: function objects, pointing to pointers to methods or functions. If you do this for static functions, omit some_object_ptr.
some_func some_method ( std::bind ( some_method_ptr, some_object_ptr, _1, _2 )
Use std :: reinterpret_cast <intptr_t> to create a unique hash for your function and use it with std :: pair to do this for methods.
method_hash pairID ( reinterpret_cast < intptr_t > ( some_object_ptr ), reinterpret_cast < intptr_t > ( some_method_ptr ) );
Now your pair identifier can be stored in a vector or other container / array. Just make sure the indices are aligned so that the hash always matches the correct std :: function object, and you can then use find () to get the iterator in position and distance () to convert the iterator to the desired index.
Please note that this must be done every time your container is created. Since it is based on pointers, hashes will vary in different runs of your program.
source share