Listing 1: A predicate for looking for a pair with a particular first component

template<typename _P>
class FirstEquals : 
  public std::unary_function<const _P&, bool>
{
public:
  FirstEquals(_P::first_type val) : 
    m_val(val) 
  {}
  bool operator()(const _P& p)
  { return p.first == m_val; }
  
private:
  const _P::first_type m_val;
};

— End of Listing —