var.opApply

int opApply(scope int delegate(const string, ref var) dg)

Iterate over map entries as (key, ref value) pairs. For non-map types, iteration yields zero elements.

int opApply(scope int delegate(const string, ref var) @safe dg) @safe

@safe counterpart of opApply, opApply for @safe loop bodies.

int opApply(scope int delegate(const string, ref const(var)) @safe dg) const @safe

Const iteration over map entries as (key, ref const value) pairs.

int opApply(scope int delegate(ref var) dg)

Foreach iteration support over array elements.

Iteration is defined over a snapshot of the element storage captured at loop entry: references passed to the loop body always come from that captured slice, never from a reread of the receiver's union. A loop body that replaces, clears, shrinks, or appends to the iterated var therefore cannot receive a reference into an unrelated payload (string bytes, a reallocated buffer, or out-of-bounds memory); the loop simply continues over the captured elements. Structural mutation during iteration is not supported, but it can no longer corrupt memory through the @safe ref parameter.

int opApply(scope int delegate(ref var) @safe dg) @safe

@safe counterpart for @safe loop bodies.

int opApply(scope int delegate(ref const(var)) @safe dg) const @safe

Const foreach iteration over array elements.

int opApply(scope int delegate(size_t, ref var) dg)

Foreach iteration with index over array elements.

Snapshot semantics: see opApply(scope int delegate(ref var)).

int opApply(scope int delegate(size_t, ref var) @safe dg) @safe

@safe counterpart for @safe loop bodies.

int opApply(scope int delegate(size_t, ref const(var)) @safe dg) const @safe

Const foreach iteration with index over array elements.