본문 바로가기
트레이딩/메타트레이더 코딩

MQL5. Generic Data Collection. CHashMap. 딕셔너리

by i.got.it 2019. 5. 18.

 

 

/////////////// example 1. dictionary

 CHashMap<string, int> d;
   
   d.Add("one", 1);
   d.Add("two", 2);
   d.Add("three", 3);
   
   string keys[];
   int values[];
   d.CopyTo(keys, values);
   for (int i=0; i<d.Count(); i++)
      Print(keys[i], " ", values[i]);
   
/////////////// example 2. dictionary 

#include <generic/hashmap.mqh>
#include <generic/arraylist.mqh>

void OnStart()
{
   CHashMap<string, CArrayList<bool>*> dict;
   bool flags[] = {false, false, true, true};
   CArrayList<bool> array_flags(flags);
   dict.Add("flags", &array_flags);
   
   CArrayList<bool> *temp;
   if(dict.TryGetValue("flags", temp)) {
      for(int i=0; i<temp.Count(); i++) {
         bool flag;
         if(temp.TryGetValue(i, flag)) {
            Print(flag);
         }
      }
   }   
}

from : https://www.mql5.com/en/forum/304390https://www.mql5.com/en/forum/294861

 

 

 

 

상세. 

MQL5. Generic Data Collection 전체. 

https://www.mql5.com/en/docs/standardlibrary/generic

 

Documentation on MQL5: Standard Library / Generic Data Collections

Generic Data Collections The library provides classes and interfaces that define generic collections, which allow users to create strongly typed collections. These collections provide greater convenience and data handling performance than non-generic typed

www.mql5.com

 

CHashMap 

https://www.mql5.com/en/docs/standardlibrary/generic/chashmap

 

Documentation on MQL5: Standard Library / Generic Data Collections / CHashMap<tkey,tvalue></tkey,tvalue>

CHashMap CHashMap is a generic class that implements the IMap interface. Description The CHashMap class is an implementation of the dynamic hash table, the data of which are stored in the form of unordered key/value pairs taking into account the key unique

www.mql5.com

 


첫등록 : 2019년 5월 18일

최종수정 : 

 

본 글 단축주소 : https://igotit.tistory.com/2176

 


 

 

 

댓글



 

비트코인




암호화폐       외환/나스닥/골드         암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)         프랍 트레이더 온라인 지원가능. MT4,MT5