The code is as follows:
The class SNew
{
Public:
SNew ()
{
M_nValue=https://bbs.csdn.net/topics/1;
}
Virtual ~ SNew ()
{
}
Int m_nValue;
};
Int _tmain (int arg c, _TCHAR * argv [])
{
SNew * pValue=https://bbs.csdn.net/topics/new SNew ();
VectorVpData. Push_back (pValue);
Vectorfor (int i=0; i{
VpData2. Push_back (vpData. At (I));
}
For (vector{
SNew * pTmp=* it;
The delete pTmp;
PTmp=NULL;
It=vpData. Erase (it);
}
SNew * pTmp2=vpData2. Ats (0); //pointer to the pointer to 0 xfeeefeee wild, how to design the NULL?
return 0;
}
PS: not allowed in the for loop vpData2 processing situation, how to make vpData2 elements automatically become NULL?
CodePudding user response:
In the vpData delete vpData2 also deleted
CodePudding user response: