add alloc func at AutoDeleteArray<>

This commit is contained in:
2020-11-05 14:00:20 +08:00
parent be48e1147a
commit 1fad869095

View File

@@ -538,6 +538,25 @@ namespace hgl
delete[] obj;
}
T *alloc(const size_t count)
{
if(!obj)
delete[] obj;
if(count<=0)
{
obj=nullptr;
size=0;
}
else
{
obj=new T[count];
size=count;
}
return obj;
}
T *operator -> (){return obj;}
T *data(){return obj;}