lu.array

Simple array utilities.

Members

Functions

uniqueKey
auto uniqueKey(AA aa, K min, K max, V value)

Returns a unique key for the passed associative array. Reserves the key by assigning it a value.

zero
void zero(Sink sink, bool clear, T zeroValue)

Zeroes out the contents of an Appender.

Examples

string[int] aa;

immutable key = aa.uniqueKey;

assert(key > 0);
assert(key in aa);
assert(aa[key] == string.init);

Appender!(int]) sink;
sink.put(1);
sink.put(2);
sink.put(3);

sink.zero(clear: false);
assert(sink.data == [ 0, 0, 0 ]);

sink.zero(clear: false, 42);
assert(sink.data == [ 42, 42, 42 ]);

sink.zero();  //(clear: true);
assert(!sink.data.length);

Meta