CreateElement

지정한 위치에 새 배열 요소를 작성합니다.

bool  CreateElement(
   int  index      // 위치
   )

Parameters

index

[in] 새 요소를 작성할 위치.

Return Value

성공적이면 true, 요소를 생성할 수 없으면 false.

Note

CArrayObj 클래스의 메서드 CreateElement(int)는 항상 false를 반환하며 어떠한 작업도 수행하지 않습니다. 필요한 경우 CreateElement(int) 메서드를 파생 클래스에서 구현해야 합니다.

예제:

//--- CArrayObj::CreateElement(int) 예제
#include <Arrays\ArrayObj.mqh>
//---
void OnStart()
  {
   int        size=100;
   CArrayObj *array=new CArrayObj;
   //---
   if(array==NULL)
     {
      printf("객체 생성 오류");
      return;
     }
   //--- 배열 채우기
   array.Reserve(size);
   for(int i=0;i<size;i++)
     {
      if(!array.CreateElement(i))
        {
         printf("요소 생성 오류");
         delete array;
         return;
        }
     }
   //--- 배열 사용
   //--- . . .
   //--- 배열 삭제
   delete array;
  }