Associative arrays
Brian Schott via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Nov 9 17:29:10 PST 2015
On Monday, 9 November 2015 at 21:33:09 UTC, TheFlyingFiddle wrote:
> On Monday, 9 November 2015 at 04:52:37 UTC, rsw0x wrote:
>> On Monday, 9 November 2015 at 04:29:30 UTC, Rikki Cattermole
>> wrote:
>> Fwiw, EMSI provides high quality containers backed by
>> std.experimental.allocator.
>> https://github.com/economicmodeling/containers
>
> I have a question regarding the implementation of the
> economicmodeling hashmap. Why must buckets be a power of two?
> Is it to be able to use the: hash & (buckets.length - 1) for
> index calculations or is there some other reason?
Yes. It's a hack that gives you a modulus without having to do a
modulus. It only works on powers of two.
More information about the Digitalmars-d-learn
mailing list