Find pair by key within a vector of pairs in C++ 98
<p>I am using the below version and will not be able to use C++11
g++ (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973].</p>

<p>I have a vector of pairs.</p>

<pre><code>  std::vector&lt;std::pair&lt;int, std::string&gt; &gt; vec;
  vec.push_back(std::make_pair(5, std::string("tata")));
  vec.push_back(std::make_pair(6, std::string("tat2")));
  vec.push_back(std::make_pair(7, std::string("tat3")));
  vec.push_back(std::make_pair(8, std::string("tat4")));
</code></pre>

<p>now I can use iterator to search all the elements in the vector using a key of the pair, like </p>

<pre><code>    std::vector&lt;std::pair&lt;int, std::string&gt; &gt;:: iterator it ;
    for (it = vec.begin(); it != vec.end(); ++it)
    {
      if (it-&gt;first == item)
      {
        cout &lt;&lt; "Found " &lt;&lt; item &lt;&lt; "\n";
        return 0;
      }
    }
</code></pre>

<p>I wish is there any possible way to use std::find operations in C++98 , as I have searched related posts and most of them solved that which is supported in C++ 11.  </p>