
Below is an example that fails to compile. I have a vector of pointers to a templated class and I need to use find_if. My understanding of boost::bind. is that the first argument, when binding member function, is an explicit "this" pointer, that should be A* in my case. Any help in explaining what I am doing wrong will be greatly appreciated. #include <algorithm> #include <string> #include <vector> #include <boost/bind.hpp> #include <algorithm> #include <string> #include <vector> #include <boost/bind.hpp> template<typename T> class A { T _val; public: A(T val) : _val(val){}; T Val() {return _val;} bool CompareByVal(A<T>* a, int iType, T ofval) { return ( (a != NULL) && (iType == 1) && (a->Val() == ofval) ); } }; int _tmain(int argc, _TCHAR* argv[]) { std::vector<A<int>*> a; std::find_if (a.begin(), a.end(), boost::bind(&A<int>::CompareByVal, _1, _2, 1,1)); }