----- Original Message -----
From: "Igor R"
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.?
I don't want to find elements equal to a specific element. I want to find an element that meets specific criteria -- that is, find the element for which two of its data members have specific values. If I already had all the criteria for the element, I wouldn't need to find it in the first place! - Dennis