C++中有auto_ptr,可以把动态分配的内存自动的delete掉,但是auto_ptr有个缺点,就是不能delete数组。即它只能调用delete,不能调用delete来释放数组并正确调用析构函数