title: extraneous calls to copy-constructor and destructor
body: <p><em>[a follow up to <a href="https://stackoverflow.com/questions/2627540/why-does-the-destructor-of-the-class-called-twice">this question</a>]</em></p>
  
  <pre><code>class A
  {
      public:
           A()          {cout&lt;&lt;"A Construction"     &lt;&lt;endl;}
           A(A const&amp; a){cout&lt;&lt;"A Copy Construction"&lt;&lt;endl;}
          ~A()          {cout&lt;&lt;"A Destruction"      &lt;&lt;endl;}
  };
  
  int main() {
      {
          vector&lt;A&gt; t;
          t.push_back(A());
          t.push_back(A());   // once more
      }
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>A Construction        // 1
  A Copy Construction   // 1
  A Destruction         // 1
  A Construction        // 2
  A Copy Construction   // 2
  A Copy Construction   // WHY THIS?
  A Destruction         // 2
  A Destruction         // deleting element from t
  A Destruction         // deleting element from t
  A Destruction         // WHY THIS?
  </code></pre>