RehashingAA.dup

Duplicates this. Explicitly copies the internal associative array.

If No.copyState 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 Flag!"copyState" copyState = No.copyState
)

Parameters

copyState Flag!"copyState"

(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(Yes.copyState);
assert(aa2 == aa);
assert(aa2.numRehashes == 1);

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