byKey
fn
auto byKey(T : V[K], K, V)(T aa) pure nothrow @nogc @safeReturns a forward range which will iterate over the keys of the associative array. The keys are returned by reference.
If structural changes are made to the array (removing or adding keys), all ranges previously obtained through this function are invalidated. The following example program will dereference a null pointer:
import std.stdio : writeln;
auto dict = ["k1": 1, "k2": 2];
auto keyRange = dict.byKey;
dict.clear;
writeln(keyRange.front); // Segmentation faultParameters
aa | The associative array. |
Returns
A forward range referencing the keys of the associative array.
fn
auto byKey(K, V)(V[K] * aa) pure nothrow @nogcditto