You could use a std::unordered_map
to hold this, ie: std::unordered_map<int, std::array<int, 4>>
.
The use of unordered_map
will provide faster access by key. From this documentation:
unordered_map containers are faster than map containers to access individual elements by their key, although they are generally less efficient for range iteration through a subset of their elements.