
Hello, Could you please tell me how to compare two boost::function objects packet with boost::ref. I have container which has boost::function elements and to add elements is not a problem but to remove particular one I don't know how to do that (compare two boost:ref-s). The problem is shown in the code below. Regards, Bartek //code #include <iostream> #include <list> #include <boost/ref.hpp> #include <boost/function.hpp> struct test{ int a; void operator() (int aa) { a += aa; } }; struct function_list { std::list<boost::function<void (int v)> > fun_list; void add(boost::function<void (int v)> fun) { fun_list.push_back(fun); } void remove(boost::function<void (int v)> fun) { std::list<boost::function<void (int v)> >::iterator iter; //HOW TO IMPLEMETN THIS FIND_IF? //std::find_if(fun_list.begin(), fun_list.end(), MISSING_PART); if(iter != fun_list.end()) fun_list.erase(iter); } }; int main(int argc, char **argv) { test a, b; function_list f; f.add(boost::ref(a)); f.add(boost::ref(b)); //DOES NOT WORK f.remove(boost::ref(a)); }