fixed List/ObjectList/Queue in C++17/20
This commit is contained in:
parent
ee2bf2b9b8
commit
a82810d58a
@ -192,15 +192,8 @@ namespace hgl
|
||||
virtual void operator << (const T &obj){Add(obj);} ///<操作符重载添加一个数据
|
||||
virtual void operator -= (const T &obj){DeleteByValue(obj);} ///<操作符重载删除一个数据
|
||||
|
||||
T * GetPointer(const int index) ///<取得指定序列号数据的索引
|
||||
{
|
||||
return(index>=count?nullptr:items+index);
|
||||
}
|
||||
|
||||
const T * GetPointer(const int index) const ///<取得指定序列号数据的索引
|
||||
{
|
||||
return(index>=count?nullptr:items+index);
|
||||
}
|
||||
T * GetPointer(const int index) {return data_array.GetPointer(index);} ///<取得指定序列号数据的索引
|
||||
const T * GetPointer(const int index)const{return data_array.GetPointer(index);} ///<取得指定序列号数据的索引
|
||||
|
||||
bool Get(int index, T &data)const {return data_array.ReadAt (data,index);} ///<取得指定索引处的数据
|
||||
virtual bool Set(int index,const T &data) {return data_array.WriteAt(data,index);} ///<设置指定索引处的数据
|
||||
|
@ -38,7 +38,7 @@ namespace hgl
|
||||
|
||||
virtual void Clear() override ///<清除所有数据,但不清空缓冲区
|
||||
{
|
||||
for(auto *obj:data_array)
|
||||
for(auto *obj:List<T *>::data_array)
|
||||
DeleteObject(obj);
|
||||
|
||||
List<T *>::Clear();
|
||||
@ -46,7 +46,7 @@ namespace hgl
|
||||
|
||||
virtual bool IsExist(const ItemPointer &flag)const override ///<确认数据项是否存在
|
||||
{
|
||||
return this->Find((T *)flag)!=-1;
|
||||
return List<T *>::Find((T *)flag)!=-1;
|
||||
}
|
||||
|
||||
virtual bool Unlink(int index){return List<T *>::Delete(index);} ///<将指定索引处的数据与列表断开
|
||||
@ -60,7 +60,7 @@ namespace hgl
|
||||
|
||||
bool _Delete(int index,int num)
|
||||
{
|
||||
if(index<0||num<=0||index+num>=GetCount())
|
||||
if(index<0||num<=0||index+num>=List<T *>::GetCount())
|
||||
return(false);
|
||||
|
||||
ItemPointer *p=data_array.data()+index;
|
||||
|
@ -198,8 +198,8 @@ namespace hgl
|
||||
{
|
||||
ObjectQueue<T>::Clear(olc);
|
||||
|
||||
data_array[0].Free();
|
||||
data_array[1].Free();
|
||||
this->data_array[0].Free();
|
||||
this->data_array[1].Free();
|
||||
}
|
||||
};//template<typename T> class ObjectQueue
|
||||
}//namespace hgl
|
||||
|
Loading…
x
Reference in New Issue
Block a user