www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Store multiple identical objects in a key:ed datastructure?

Consider a complex key that is a combination of multiple 

struct key
   int    foo = 1;
   string bar = "joy";
   string baz = "huzza";

The value is a very large object.

struct value
   int[4096] payload;

There are 10.000s of different keys.
But typically only ~10 different values.

My first idea was to have an array/set of unique value instances 
and store only the index to the array in the key:ed data 
structure, this way it's possible to reallocate and extend the 

Is there an idiomatic way to solve this in D? Or should I just 
get my hands dirty and do the brute force implementation of the 
above idea?
Nov 01 2019