There is a workaround that works, and also uses .byKeys() :
auto anyKey(K, V)(inout ref V[K] aa) { foreach (K k, ref inout(V) v; aa) return k; assert(0, "Associative array hasn't any keys."); }
For my needs .byKeys().front seems fast enough. Not sure if the workaround is actually faster.
source share