I use c++. Suppose I write the following code:
struct node
{
int sum;
int min;
};
vector<node> arrnode;
for(int j=0;j<n;j++)
{
node n1;
n1.sum=0;
n1.min=0;
arrnode.push_back(n1);
}
I know that n1 is a local variable and its destroyer is called when I move from xth to (x+1)th count of 'j' in the for loop.But what about the object which is made by invoking copy constructor of n1 and is inserted into the vector arrnode. Will it be destroyed only when arrnode is destroyed?