title: Why don't vector elements print?
body: <p>I have a regex function that parses a URL request and finds a match for an IP and port pattern. I want to push these matches into a vector and then print them out to the screen. The size of the vector prints to the screen but nothing is printed to the screen when I attempt to iterate through the vector and print the elements.</p>
  
  <p>code:</p>
  
  <pre><code>    std::vector&lt;std::string&gt; matchVector;
      std::smatch m;
      std::regex e ("\\/([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})\\:?([0-9]{1,5})");
      while (std::regex_search (requestURL,m,e))
      {
          for (auto x:m)
              {
                  std::stringstream ss;
                  ss &lt;&lt; x;
                  std::string str = ss.str();
                  matchVector.push_back(str);
                  std::cout &lt;&lt; "match " &lt;&lt; str &lt;&lt; " ";
              }
          std::cout &lt;&lt; std::endl;
          requestURL = m.suffix().str();
      }
      std::cout &lt;&lt; "print vector of size : " &lt;&lt; matchVector.size()&lt;&lt; '\n';
  
      //this is where nothing prints to the screen
      for (int i =0; i &lt; matchVector.size(); i++)
      {
          std::cout &lt;&lt; matchVector[i];
      }
  </code></pre>
  
  <p>current output:</p>
  
  <pre><code>match /192.xxx.111.xxx:8080 match 192.xxx.111.xxx match 8080
  print vector of size : 3
  </code></pre>