. , ( ++ 0x) - _.second .
:
template <class Second>
class CompareSecond
{
public:
CompareSecond(Second const& t) : m_ref(t) {}
template <class First>
bool operator()(std::pair<First,Second> const& p) const { return p.second == m_ref; }
private:
Second const& m_ref;
};
:
template <class Second>
CompareSecond<Second> compare_second(Second const& t)
{
return CompareSecond<Second>(t);
}
.
CMyList::iterator it = std::find_if(myList.begin(), myList.end(), compare_second(i));
, .
, , , , , .
:
, STL, , :
CMyList::iterator it = toolbox::find_if(myList, compare_second(i));
(imho) , auto .