CHashArrayStringString - MetaTrader 5 Library - MT4/MT5 Resources


The include file contains a set of classes that demonstrate one of the methods of organizing row hash arrays using string keys.
Usage example:
#include <hasharray.mqh> blank on startup () { 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); }

Performance test:
The include file contains a set of classes that demonstrate one of the methods of organizing row hash arrays using string keys.
#include <hasharray.mqh> blank on startup () { CHashArrayStringString Hash(); Unit start time = get tick number (); for ( integer n= 0 ; n< 10000 ; n++) { Hash[ "key" + integer to string (n)] = "garbage" ; } Total unit time = get tick number () - start time; Alert ( "Add 10k elements in" , integer to string (total time), "Multiple Sclerosis" ); }
Add 10k elements in 31 milliseconds 
Attachment download
📎 test_chasharraystringstring.mq5 (1.16 KB)
📎 test_chasharrayperformance.mq5 (1.09 KB)
📎 hasharray.mqh (5.08 KB)
Source: MQL5 #7047
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •