fixed few bug.

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-07-28 20:11:16 +08:00
parent dff19d4be9
commit 116799bc4e
3 changed files with 58 additions and 53 deletions

View File

@ -13,6 +13,7 @@ namespace hgl
#define CompOperatorMemcmp(name) int _Comp(name data)const{return memcmp(this,&data,sizeof(name));} \
CompOperator(name,_Comp)
}//namespace hgl
/**
*
@ -34,7 +35,7 @@ namespace hgl
*/
virtual void exchange(T &a,T &b)
{
hgl_swap(a,b);
hgl::hgl_swap(a,b);
}
/**
@ -55,19 +56,23 @@ namespace hgl
void cpy(type *t,type *s){*t=*s;} \
};
COMPARATOR_ORIGIN_TYPE(int8)
COMPARATOR_ORIGIN_TYPE(int16)
COMPARATOR_ORIGIN_TYPE(int32)
COMPARATOR_ORIGIN_TYPE(int64)
COMPARATOR_ORIGIN_TYPE(hgl::int8)
COMPARATOR_ORIGIN_TYPE(hgl::int16)
COMPARATOR_ORIGIN_TYPE(hgl::int32)
COMPARATOR_ORIGIN_TYPE(hgl::int64)
COMPARATOR_ORIGIN_TYPE(uint8)
COMPARATOR_ORIGIN_TYPE(uint16)
COMPARATOR_ORIGIN_TYPE(uint32)
COMPARATOR_ORIGIN_TYPE(uint64)
COMPARATOR_ORIGIN_TYPE(hgl::uint8)
COMPARATOR_ORIGIN_TYPE(hgl::uint16)
COMPARATOR_ORIGIN_TYPE(hgl::uint32)
COMPARATOR_ORIGIN_TYPE(hgl::uint64)
COMPARATOR_ORIGIN_TYPE(float)
COMPARATOR_ORIGIN_TYPE(double)
#if __cpp_char8_t
COMPARATOR_ORIGIN_TYPE(char8_t)
#endif//
COMPARATOR_ORIGIN_TYPE(char)
COMPARATOR_ORIGIN_TYPE(wchar_t)
@ -77,5 +82,5 @@ namespace hgl
COMPARATOR_ORIGIN_TYPE(char32_t)
#undef COMPARATOR_ORIGIN_TYPE
}//namespace hgl
#endif//HGL_COMP_OPERATOR_INCLUDE

View File

@ -134,7 +134,7 @@ namespace hgl
for(int i=0;i<count;i++)
{
//if((*data_array)->value==data)
if(hgl_cmp(data_array[i]->value,data)==0)
if(hgl_cmp((*data_array)->value,data)==0)
return(i);
++data_array;

View File

@ -121,8 +121,8 @@ namespace hgl
return total;
}
void Clear (){delete_list.Clear();} ///<清除数据
void ClearData (){delete_list.ClearData();} ///<清除数据,但不释放内存
void Clear (){data_list.Clear();} ///<清除数据
void ClearData (){data_list.ClearData();} ///<清除数据,但不释放内存
bool Get (const int index,T &data) ///<根据序列号取得指定数据
{