当只能离开了定义域就会自动释放。
在堆上声明一个simple对象
auto_ptr<simple> mySimpleSmartPtr(new simple());
这个mySimpleSmartPtr会自动释放。
相当于
simple *mySimpleSmartPtr = new simple();
当只能离开了定义域就会自动释放。
在堆上声明一个simple对象
auto_ptr<simple> mySimpleSmartPtr(new simple());
这个mySimpleSmartPtr会自动释放。
相当于
simple *mySimpleSmartPtr = new simple();