November 01, 2019 Store multiple identical objects in a key:ed datastructure? | ||||
---|---|---|---|---|
| ||||
Consider a complex key that is a combination of multiple variables. 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 array. 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? |
Copyright © 1999-2021 by the D Language Foundation