Base Pointer member functions failure

Okay, Call me stupid but I can't get this to work class Base { virtual const bool CheckFunc(const value& val ) const { return true; } } class Derived1: public Base { } class Derived2: public Base { } // some where else in code Derived1 dev1; Derived2 dev2; vector<Base *> vecBase; vecBase.push_back( &dev1 ); vecBase.push_back( &dev2 ); value aVal; vec<Base *> std::find_if( vecBase.begin(), vecBase.end(), boost::bind( Base::CheckFunc, aVal ) ); I have tried a gazillion things a thought would work using mem_fun_ref and such. This ones get's me the closest I believe but I get a bunch of qualifier to funcation type has no meaning warnings. As well I get a condiation expression of type 'overloaded-function is illegal. I am using VS.Net 2003. Any ideas on what I am missing. As well can I get my cake and eat it to by making the CheckFunc virtual and have it resolve to the derived form? TIA Mark Loew, MCSD, MCSE Application Development Consultant Sagestone Consulting www.sagestone.com <http://www.sagestone.com/> Grand Rapids, MI 616-954-9556 x149 Microsoft Gold Certified Partner mloew@sagestone.com

On Friday 26 September 2003 05:58 pm, Mark Loew wrote:
vec<Base *> std::find_if( vecBase.begin(), vecBase.end(), boost::bind( Base::CheckFunc, aVal ) );
I think you meant: vec<Base *> std::find_if( vecBase.begin(), vecBase.end(), boost::bind( &Base::CheckFunc, _1, aVal ) ); Doug

Mark Loew wrote:
Okay,
Call me stupid but I can't get this to work
class Base { virtual const bool CheckFunc(const value& val ) const { return true; } }
[...]
std::find_if( vecBase.begin(), vecBase.end(), boost::bind(Base::CheckFunc, aVal ) );
Try boost::bind(&Base::CheckFunc, _1, aVal) instead. Remember that a member function has an implicit 'this' argument.
participants (3)
-
Douglas Gregor
-
Mark Loew
-
Peter Dimov