stl里面只有一个auto_ptr,没有auto_array,欢迎大家指教。
/*
auto_array.h
sdragon 2006-11-23 14:03:20
*/
#ifndef AUTO_ARRAY_H_20061123140320
#define AUTO_ARRAY_H_20061123140320
#include <memory>
using std::auto_ptr;
template<typename T>
class auto_array:public auto_ptr<T>
{
public:
auto_array():auto_ptr<T>(){}
explicit auto_array(T* p):auto_ptr<T>(p){}
auto_array(size_t n):auto_ptr<T>(new T[n]){} //ext
~auto_array()
{
if(this->_M_p){
delete []this->get();
this->_M_p = NULL;
}
}
};
#endif //AUTO_ARRAY_H_20061123140320