Skip to content
All library documents

MQL5 Dictionary with FNV-1a Hashing and Typed Keys

Article MQL5 code base

Summary

The document describes an MQL5 implementation of an associative array built on collection classes. It uses FNV-1a hashing and provides typed Set and Get operations for primitive values, with examples using strings and doubles. It also permits storing pointers to objects, while stating that objects or structures themselves cannot be stored directly.

For collision handling, entries with matching hashes are checked using both key and type name. Consequently, one key can hold values of different types. Setting a value for a key and type that already exists replaces that entry, including when the value is a pointer. This is a programming utility rather than a trading method; the material offers no benchmarks or discussion of hash distribution, memory ownership, or concurrency. Users applying the implementation would need to review those concerns in the surrounding code and environment.

Key ideas

  • The MQL5 utility implements a typed associative array using FNV-1a hashing.\nPrimitive values can be stored and retrieved with type-specific operations.\nThe dictionary stores pointers to objects but not objects or structures directly.\nCollisions are resolved by comparing both the key and the value type.\nSetting an existing key and type replaces its stored value.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.