added newly hgl_new_cpy function

This commit is contained in:
2022-01-07 16:15:39 +08:00
parent 1cefb338da
commit c667f679c6

View File

@@ -400,15 +400,25 @@ namespace hgl
}
template<typename T>
inline T *hgl_copy_new(const size_t count,const T *src)
inline T *hgl_new_copy(const T *src,const size_t count)
{
if(count<=0)return(nullptr);
if(!src||count<=0)return(nullptr);
T *data=new T[count];
memcpy(data,src,count*sizeof(T));
return data;
}
template<typename T>
inline T *hgl_new_copy(const T *src)
{
if(!src)return(nullptr);
T *data=new T;
memcpy(data,src,sizeof(T));
return data;
}
/**
* 指定类型数据清0
*/