删除

删除列表指定位置的元素。

bool  Delete(
   int  pos      // 位置
   )

参数

pos

[输入]  在列表中删除元素的位置。

返回值

true 如果成功, false - 如果您未能删除元素。

注释

如果启用了内存管理,内存占位符释放。

例如:

//--- 例程 CList::Delete(int)
#include <Arrays\List.mqh> 
//--- 
void OnStart() 
  { 
   CList *list=new CList; 
   //--- 
   if(list==NULL
     { 
      printf("对象创建错误"); 
      return
     } 
   //--- 添加列表元素 
   //--- . . . 
   if(!list.Delete(0)) 
     { 
      printf("删除错误"); 
      delete list; 
      return
     } 
   //--- 删除列表 
   delete list; 
  }