
Misiu wrote:
Ovanes Markarian napisaĆ(a):
[...]
You could also skip the compare_functions implementation and use boost::lambda and placeholder library to write you code like this: std::find_if(fun_list.begin(), fun_list.end(), _1==fun);
When I tried this solution (really nice one) on MSVC 2003 I got this error:
d:\boost_ref_test\main.cpp(18): error C2666: 'boost::operator`=='' : 4 overloads have similar conversions
You can't compare two function<> objects with ==. What you can do is compare a function<> with the actual contents. That is, void f(); function<void()> f2( f ); f2 == f; // true f2 == f2; // fails at compile time So if you pass the actual object as 'fun' above, instead of converting it to a function<> first, you should be able to use find_if (or just find).