当vector中存储的类型为指针时,vector.clear()的执行结果

#include 
#include 
using namespace std;
class A {
	private :
		int nId;
	public:
	A(int n)	{	nId = n; 
	cout << nId << " contructor" << endl;  }
	~A( ) 
	 {cout << nId << " destructor" << endl; }
};
int main()  {
	vector vp;
	vp.push_back(new A(1));
	vp.push_back(new A(2));
	cout<


你可能感兴趣的:(C++学习随笔,C++,vector,指针)