title: How can I use find() on a map inside a vector of maps?
body: <p>I want to access specific elements in a vector of maps. My code is as follows:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;map&gt;
  
  using namespace std;
  
  int main() {
      std::vector&lt;map &lt;string, int&gt; &gt; vecOfMaps;
      map &lt;string, int&gt; myMap;
  
      for (int j = 0; j &lt; 10; j++) {
          myMap["alpha"] = j;
          myMap["beta"] = j*2;
          vecOfMaps.push_back(myMap);
      }
  
      int start = 3;
      int end = 5;
      int counter = start;
  
      for (std::vector&lt;map &lt;string, int&gt; &gt;::iterator vecIter = vecOfMaps.begin()+start; vecIter != vecOfMaps.begin()+end; ++vecIter) {
          map&lt;string, int&gt;::iterator mapIter = vecIter.find("alpha");
          cout &lt;&lt; "\n vecElement " &lt;&lt; counter &lt;&lt; " mapString " &lt;&lt; mapIter-&gt;first &lt;&lt; " mapInt " &lt;&lt; mapIter-&gt;second;
          counter++;
      }
      return 0;
  }
  </code></pre>
  
  <p>However, this code gives the following compilation error:</p>
  
  <blockquote>
    <p>error: ‘std::vector, int> >::iterator’ has no member named ‘find’<br>
    map::iterator mapIter = vecIter.find("alpha");</p>
  </blockquote>
  
  <p>How to find an entry inside a map in a vector of maps?</p>