#include <iostream>
#include <vector>
using namespace std;
class A
{
public:
A(){cout<<"A Contruction"<<endl;}
~A(){cout<<"A destruction"<<endl;}
};
int main()
{
vector<A> t;
A a;
A b;
t.push_back(a);
t.push_back(b);
return 0;
}
Output:
A Contruction
A Contruction
A destruction
A destruction
A destruction
A destruction
A destruction
Am unable to understand the destruction call. First 2 destruction are for copy constructor being called in vector.