title: Vector is not "saving values" C++
body: <p>When reading from vector I put values in I got zero size. I have:</p>
  
  <pre><code>class Graph {
  public:
      vector&lt;Vertex&gt; vertices;
  };
  
  class Vertex {
  public:
      vector&lt;int&gt; adjacentVertices;
  };
  </code></pre>
  
  <p>In my load method then:</p>
  
  <pre><code>int vertices, edges;
  cin &gt;&gt; vertices &gt;&gt; edges;
  Graph mainGraph;
  mainGraph.vertices.reserve(static_cast&lt;unsigned int&gt;(vertices));
  int tmp1, tmp2;
  for (int i = 0; i &lt; edges; i++) {
      cin &gt;&gt; tmp1 &gt;&gt; tmp2;
      mainGraph.vertices[tmp1].adjacentVertices.push_back(tmp2);
      cout &lt;&lt; mainGraph.vertices[tmp1].adjacentVertices.size(); //PRINTS NUMBERS -&gt; SEEMS OKAY
  }
  
  cout &lt;&lt; mainGraph.vertices.size(); //IS ZERO???
  
  for(const Vertex &amp;v : mainGraph.vertices){ //CRASHES
      cout &lt;&lt; v.adjacentVertices.size();
  }
  </code></pre>
  
  <p>I bet this is very stupid but what am I missing? I read the vector will self construct itself upon use if no special constructor is needed.</p>