Use Entry struct from TypeInfo_AssociativeArray instead of local one, (#20900)

just one less template and one less place to maintain.
This commit is contained in:
Steven Schveighoffer 2025-02-19 17:00:27 -05:00 committed by GitHub
parent 016c38e276
commit 60a3060cdf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -75,15 +75,6 @@ private size_t mix(size_t h) @safe pure nothrow @nogc
return h;
}
struct Entry(K, V)
{
// can make this const, because we aren't really going to use it aside from
// construction.
const K key;
V value;
}
// create a binary-compatible AA structure that can be used directly as an
// associative array.
// NOTE: this must only be called during CTFE
@ -92,7 +83,7 @@ AAShell makeAA(K, V)(V[K] src) @trusted
assert(__ctfe, "makeAA Must only be called at compile time");
immutable srclen = src.length;
assert(srclen <= uint.max);
alias E = Entry!(K, V);
alias E = TypeInfo_AssociativeArray.Entry!(K, V);
if (srclen == 0)
return AAShell.init;
// first, determine the size that would be used if we grew the bucket list