I am currently using find_if with bind2nd to perform a search on a vector. My current code looks like this:
struct OverrideMatches : public std::binary_function
{ bool operator()( const TItemOverride& OverrideSource, TItemOverride OverrideTarget ) const { return OverrideSource.ChildAssyItemRecNo == OverrideTarget.ChildAssyItemRecNo && OverrideSource.LinkItemRecNo == OverrideTarget.LinkItemRecNo; } }; TItemOverrideGateway::Container_t::iterator where = std::find_if( FOverridesContainer.begin(), FOverridesContainer.end(), std::bind2nd( OverrideMatches(), TItemOverride( "", 0, "", 0, ChildItemRecNo, LinkItemRecNo ) ) );
Excuse my ignorance, but if you just want to find elements equal to some specific element, why don't you use simply std::find() -- without binds etc.?