renamed to PreAlloc instead of PreMalloc

This commit is contained in:
2023-07-20 14:28:50 +08:00
parent 09eec7e7df
commit 8bb5374ab1
6 changed files with 8 additions and 8 deletions

View File

@@ -606,7 +606,7 @@ namespace hgl
if(count<=0)return;
with_list.PreMalloc(count);
with_list.PreAlloc(count);
const KVData *sp=this->GetDataList();
@@ -630,7 +630,7 @@ namespace hgl
if(count<=0)return;
without_list.PreMalloc(count);
without_list.PreAlloc(count);
const KVData *sp=this->GetDataList();

View File

@@ -64,9 +64,9 @@ namespace hgl
* 在指定位置插入一个对象
*/
template<typename T>
void CusObjectList<T>::Insert(int index,const ItemPointer &obj)
bool CusObjectList<T>::Insert(int index,const ItemPointer &obj)
{
List<T *>::Insert(index,obj);
return List<T *>::Insert(index,obj);
}
/**

View File

@@ -6,7 +6,7 @@
namespace hgl
{
template<typename T>
void Pool<T>::PreMalloc(int num,bool set_to_max_count)
void Pool<T>::PreAlloc(int num,bool set_to_max_count)
{
if(num<=0)return;

View File

@@ -44,7 +44,7 @@ namespace hgl
Pool(){alloc_count=0;history_max=0;max_count=0;}
virtual ~Pool()=default;
virtual void PreMalloc(int,bool set_to_max=false); ///<预分配空间
virtual void PreAlloc(int,bool set_to_max=false); ///<预分配空间
virtual int SetMaxCount(int); ///<设定最大数量限制

View File

@@ -32,7 +32,7 @@ namespace hgl
virtual ~SortedSets()=default;
void SetCount (int count){data_list.SetCount(count);} ///<指定数据数量,一般用于批量加载前的处理
void PreMalloc (int count){data_list.PreMalloc(count);} ///<预分配指定数量的数据空间
void PreAlloc (int count){data_list.PreAlloc(count);} ///<预分配指定数量的数据空间
const int Find (const T &)const; ///<查找数据位置,不存在返回-1
const bool IsMember (const T &v)const{return(Find(v)!=-1);} ///<确认是否成员