added newly hgl_new_cpy function
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user