On 03/02/2017 09:09 AM, Anton Pastukhov wrote:
On Wednesday, 1 March 2017 at 19:26:23 UTC, Mike Wey wrote:
On 02/28/2017 07:16 PM, Anton Pastukhov wrote:
On Tuesday, 28 February 2017 at 17:16:43 UTC, Daniel Kozák wrote:
[...]
Thank you for the link, it was informative reading. It's a pity that
still there is no ordered AA at least as a library type.
I had the same use case in the generator for GtkD, i needed fast
lookup while iteration needed to preserve the insertion order. I opted
for storing nodes of a linked list in the build in AA.
The implementation[1] is currently LGPL to match the rest of the
library, but if anyone would find it useful it can be changed to
something else.
[1]
https://github.com/gtkd-developers/GtkD/blob/master/wrap/utils/LinkedHasMap.d
Interesting.
How this approach is compared to array of tuples performance-wise?
The biggest difference would be that you don't have to iterate the array
to find a specific key. If you don't need to index by key i suspect a
array of tuples is slightly faster to iterate.
--
Mike Wey