RehashingAA.dup

Duplicates this. Explicitly copies the internal associative array.

If copyState: false is passed, it will not copy over the internal state such as the number of rehashes and keys added since the last rehash.

struct RehashingAA(AA : V[K], V, K)
dup
(
const bool copyState = false
)

Parameters

copyState bool

(Optional) Whether or not to copy over the internal state.

Return Value

Type: auto

A duplicate of this object.

Examples

RehashingAA!(int[string]) aa;
aa.minimumNeededForRehash = 2;

aa["abc"] = 123;
aa["def"] = 456;
aa["ghi"] = 789;
assert(aa.numRehashes == 1);

auto aa2 = aa.dup(copyState: false);
assert(aa2 == aa);
assert(aa2.numRehashes == 1);

auto aa3 = aa.dup;  //(copyState: false);
assert(aa3 == aa);
assert(aa3.numRehashes == 0);

Meta