title: converting vector iterator to pointer
body: <p>I have a vector std::vector. I would like to iterate the vector for finding a match, if found would like to return the pointer to the element as below:</p>
  
  <pre><code>const int * findint(std::vector &lt;int&gt; &amp;v, int a)
  {
          std::vector&lt;int&gt;::const_iterator i1,i2;
          i1 = v.begin();
          i2 = v.end();
          for(;i1 != i2;++i1) {
                  if(a== *i1) {
                          return(i1);
                  }
          }
          return(0);
  }
  </code></pre>
  
  <p>This was compiling and working ok with GNU g++2.95.3 compiler but not compiling with GNU g++ 4.9.2 and giving the following error:</p>
  
  <pre><code>error: cannot convert 'std::vector&lt;GenFld&gt;::const_iterator {aka __gnu_cxx::__normal_iterator&lt;const int*, std::vector&lt;int&gt; &gt;}' to 'const int*' in return
       [exec]     return(i1);
  </code></pre>
  
  <p>Need help.</p>