core.internal.newaa
template implementation of associative arrays.
Copyright
Copyright Digital Mars 2000 - 2015, Steven Schveighoffer 2022.
var _aaVersion GROW_DEN GROW_FAC GROW_NUM HASH_DELETED HASH_EMPTY HASH_FILLED_MARK INIT_DEN INIT_NUM INIT_NUM_BUCKETS SHRINK_DEN SHRINK_NUM
fn _aaClear _aaDup _aaEqual _aaGetHash _aaGetX _aaKeys _aaMove _aaOpEqual _aaRange _aaRangeEmpty _aaRangeFrontKey _aaRangeFrontValue _aaRangePopFront _aaRehash _aaValues _d_aaApply _d_aaApply2 _d_aaDel _d_aaEqual _d_aaGetRvalueX _d_aaGetY _d_aaIn _d_aaLen _d_aaNew _d_assocarrayliteralTX _newEntry _refAA _toAA compat_key gc_inFinalizer makeAA mix nextpow2 talign
Types 6
structAA(K, V)
structEntry(K, V)
Fields
K keyV valueprivate struct_noV2
Functions 48
fn
V[K] _d_aaNew(K, V)()Allocate associative array data. Called for `new SomeAA` expression. Returns: A new associative array. Note: not supported in CTFEfn
size_t _d_aaLen(K, V)(inout V[K] a)Determine number of entries in associative array. Note: emulated by the compiler during CTFEfn
V * _d_aaGetY(K, V, T : V1[K1], K1, V1, K2)(auto ref scope T aa, auto ref K2 key, out bool found)Lookup key in aa. Called only from implementation of (aa[key]) expressions when value is mutable. Params: aa = associative array key = reference to the key value found = returns whether the key was...fn
V * _aaGetX(K, V, K2, V2)(auto ref scope V[K] a, auto ref K2 key, out bool found, lazy V2 v2)Lookup key in aa. Called only from implementation of require, update and daaGetY Params: a = associative array key = reference to the key value found = true if the value was found v2 = if key not f...fn
auto _d_aaGetRvalueX(K, V, K2)(inout V[K] aa, auto ref scope K2 key)Lookup key in aa. Called only from implementation of (aa[key]) expressions when value is not mutable. Params: aa = associative array key = key value Returns: pointer to value if present, null other...fn
auto _aaDup(T : V[K], K, V)(T a)Creates a new associative array of the same size and copies the contents of the associative array into it. Params: a = The associative array.fn
auto _d_aaIn(T : V[K], K, V, K2)(inout T a, auto ref scope K2 key)Lookup key in aa. Called only from implementation of (key in aa) expressions. Params: a = associative array opaque pointer key = reference to the key value Returns: pointer to value if present, nul...fn
auto _d_aaDel(T : V[K], K, V, K2)(T a, auto ref K2 key)Delete entry scope const AA, return true if it was presentfn
int _d_aaApply(K, V, DG)(inout V[K] a, DG dg)foreach opApply over all values Note: emulated by the compiler during CTFEfn
int _d_aaApply(K, V, DG)(shared V[K] a, DG dg)fn
int _d_aaApply(K, V, DG)(shared const V[K] a, DG dg)fn
int _d_aaApply(K, V, DG)(immutable V[K] a, DG dg)fn
int _d_aaApply2(K, V, DG)(inout V[K] a, DG dg)foreach opApply over all key/value pairs Note: emulated by the compiler during CTFEfn
int _d_aaApply2(K, V, DG)(shared V[K] a, DG dg)fn
int _d_aaApply2(K, V, DG)(shared const V[K] a, DG dg)fn
int _d_aaApply2(K, V, DG)(immutable V[K] a, DG dg)fn
Impl!(K, V) * _d_assocarrayliteralTX(K, V)(K[] keys, V[] vals)Construct an associative array of type ti from corresponding keys and values. Called for an AA literal `[k1:v1, k2:v2]`. Params: keys = array of keys vals = array of values Returns: A new associati...fn
bool _d_aaEqual(K, V)(scope const V[K] a1, scope const V[K] a2)compares 2 AAs for equality (compiler hook)fn
bool _aaOpEqual(K, V)(scope /* const */ AA!(K, V) * aa1, scope /* const */ AA!(K, V) * aa2)callback from TypeInfo_AssociativeArray.equals (ignore const for now)fn
hash_t _aaGetHash(K, V)(/* scope const */ AA!(K, V) * paa)compute a hash callback from TypeInfo_AssociativeArray.xtoHash (ignore scope const for now)fn
bool _aaRangeEmpty(K, V)(AARange!(K, V) r)fn
K * _aaRangeFrontKey(K, V)(AARange!(K, V) r)fn
V * _aaRangeFrontValue(K, V)(AARange!(K, V) r)fn
void _aaRangePopFront(K, V)(ref AARange!(K, V) r)Variables 12
var
int _aaVersionAA version for debuggers, bump whenever changing the layout
private enumvar
GROW_NUM = 4private enumvar
GROW_DEN = 5private enumvar
SHRINK_NUM = 1private enumvar
SHRINK_DEN = 8private enumvar
GROW_FAC = 4private enumvar
INIT_NUM = (GROW_DEN * SHRINK_NUM + GROW_NUM * SHRINK_DEN) / 2private enumvar
INIT_DEN = SHRINK_DEN * GROW_DENprivate enumvar
INIT_NUM_BUCKETS = 8private enumvar
HASH_EMPTY = 0private enumvar
HASH_DELETED = 0x1private enumvar
HASH_FILLED_MARK = size_t(1) << 8 * size_t.sizeof - 1