title: How to release std::vector if there is no heap memory
body: <p>I have a class member variable like this:</p>
  
  <pre><code>vector&lt;vector&lt;int&gt; &gt;  m_stacks;
  </code></pre>
  
  <p>When I populate it, I do like this:</p>
  
  <pre><code>vector&lt;int&gt; v;
  v.push_back(1);
  v.push_back(2);
  m_stacks.push_back(v);
  vector&lt;int&gt; v2;
  v2.push_back(1);
  v2.push_back(2);
  m_stacks.push_back(v2);
  </code></pre>
  
  <p>Now I am wondering what I should do in the class destructor to release <code>m_stacks</code>. I do not allocate any heap memory for it, so I am struggling if I really need to do anything. Finally I come up this -</p>
  
  <pre><code>vector&lt;vector&lt;int&gt; &gt;::iterator itr = m_stacks.begin();
  for ( ; itr != m_stacks.end(); ++itr) {
    itr-&gt;clear();
  }
  </code></pre>
  
  <p>I think this is the most I need to do, I do not need to call <code>m_stacks.clear()</code>. The reason is vector's destructor can automatically release the memory. But I still need the above code though, the reason is vector's destructor does not call its element's destructor.</p>
  
  <p>Could you confirm my call?</p>