diff --git a/inc/hgl/type/List.h b/inc/hgl/type/List.h index 09cbe04..e429574 100644 --- a/inc/hgl/type/List.h +++ b/inc/hgl/type/List.h @@ -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);} ///<设置指定索引处的数据 diff --git a/inc/hgl/type/ObjectList.h b/inc/hgl/type/ObjectList.h index 8e65b69..97e83b5 100644 --- a/inc/hgl/type/ObjectList.h +++ b/inc/hgl/type/ObjectList.h @@ -36,9 +36,9 @@ namespace hgl List::Free(); } - virtual void Clear() override ///<清除所有数据,但不清空缓冲区 + virtual void Clear() override ///<清除所有数据,但不清空缓冲区 { - for(auto *obj:data_array) + for(auto *obj:List::data_array) DeleteObject(obj); List::Clear(); @@ -46,7 +46,7 @@ namespace hgl virtual bool IsExist(const ItemPointer &flag)const override ///<确认数据项是否存在 { - return this->Find((T *)flag)!=-1; + return List::Find((T *)flag)!=-1; } virtual bool Unlink(int index){return List::Delete(index);} ///<将指定索引处的数据与列表断开 @@ -54,13 +54,13 @@ namespace hgl virtual bool Unlink(int start,int number){return List::Delete(start,number);} ///<将指定索引处的数据与列表断开 virtual bool UnlinkByValue(const ItemPointer &ip){return List::DeleteByValue(ip);} ///<将一个指定数据与列表断开 virtual void UnlinkByValue(const ItemPointer *ip,int n){List::DeleteByValue(ip,n);} ///<将一批指定数据与列表断开 - virtual void UnlinkAll(){List::Clear();} ///<断开所有数据 + virtual void UnlinkAll(){List::Clear();} ///<断开所有数据 private: bool _Delete(int index,int num) { - if(index<0||num<=0||index+num>=GetCount()) + if(index<0||num<=0||index+num>=List::GetCount()) return(false); ItemPointer *p=data_array.data()+index; diff --git a/inc/hgl/type/Queue.h b/inc/hgl/type/Queue.h index 8c4a8f1..3f763d4 100644 --- a/inc/hgl/type/Queue.h +++ b/inc/hgl/type/Queue.h @@ -198,8 +198,8 @@ namespace hgl { ObjectQueue::Clear(olc); - data_array[0].Free(); - data_array[1].Free(); + this->data_array[0].Free(); + this->data_array[1].Free(); } };//template class ObjectQueue }//namespace hgl