VariantN.opIndex

Array and associative array operations. If a VariantN contains an (associative) array, it can be indexed into. Otherwise, an exception is thrown.

struct VariantN(size_t maxDataSize, AllowedTypesParam...)
inout
inout(Variant)
opIndex
(
K
)
(
K i
)

Examples

Variant a = new int[10];
a[5] = 42;
assert(a[5] == 42);
a[5] += 8;
assert(a[5] == 50);

int[int] hash = [ 42:24 ];
a = hash;
assert(a[42] == 24);
a[42] /= 2;
assert(a[42] == 12);

Meta