跳至内容

MoveToIndex

MoveToIndex

移动当前列表项至指定位置。

bool  MoveToIndex(
   int  pos      // 位置
   )

参数

pos

[输入] 在列表中移动目标位置。

返回值

true 如果成功, false - 如果您未能移动元素。

例如:

//--- 例程 CList::MoveToIndex(int)
#include <Arrays\List.mqh>
//---
void OnStart()
  {
   CList *list=new CList;
   //---
   if(list==NULL)
     {
      printf("对象创建错误");
      return;
     }
   //--- 移动当前节点至开头
   list.MoveToIndex(0);
   //--- 使用列表
   //--- . . .
   //--- 删除列表
   delete list;
  }