/////////////// 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/304390 , https://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
'트레이딩 > 메타트레이더 코딩' 카테고리의 다른 글
메타트레이더 . 코딩 . 클래스 non-static 멤버함수를 콜백함수로 전달하기 (0) | 2019.05.21 |
---|---|
MQL5. DLL. #import (0) | 2019.05.19 |
MQL5. Arrays. 배열 (0) | 2019.05.17 |
MQL5. struct. 구조체, DLL 함수인자에 구조체 전달 방법 (0) | 2019.05.16 |
메타트레이더 . 코딩 . function pointer . 콜백 함수 (0) | 2019.05.13 |
댓글