An include file contains a set of classes demonstrating one of methods of organizing lines hash array with a string key.
An example of usage:
#include <HashArray.mqh> void OnStart() Â Â { Â Â CHashArrayStringString Hash; Â Â Hash.Put("k1", "v1"); Â Â Hash.Put("k2", "v2"); Â Â Hash["k3"] = "v3"; Â Â Hash["k2"] = "vv2"; Â Â string t1 = Hash["k1"].value; Â Â string t2 = Hash["k2"].value; Â Â string t3 = Hash["k3"].value; Â Â Alert("k1=",t1); Â Â Alert("k2=",t2); Â Â Alert("k3=",t3); Â Â }
The result:
Performance test:
An include file contains a set of classes demonstrating one of methods of organizing lines hash array with a string key.
#include <HashArray.mqh> void OnStart() { Â Â CHashArrayStringString Hash(); Â Â uint StartTime=GetTickCount(); Â Â for(int n=0; n<10000; n++) Â Â { Â Â Â Â Â Â Hash["key"+IntegerToString(n)] = "trash"; Â Â } Â Â uint timeTotal = GetTickCount() - StartTime; Â Â Alert("add 10k elements in ", IntegerToString(timeTotal), " ms"); Â Â }
add 10k elements in 31 ms