Table of Contents

Struct np.NDEnumerateRef<T>

Namespace
NumSharp
Assembly
NumSharp.dll

The foreach-able returned by AsRef(bool) — the typed, allocation-free, by-ref T ndenumerate. Yields, per element, a np.NDEnumerateRef<T>.Entry carrying the coordinate (a ReadOnlySpan<T> over a reused buffer) and the value BY REFERENCE, in logical C-order (matching ndenumerate(NDArray)), write-through for every memory layout.

It composes two things that are already correct: the value ref comes from np.NDRefIter<T>.Enumerator pinned to C-order (the same engine flat<T>(NDArray, bool) drives), and the coordinate comes from a C-order odometer advanced in lockstep — since a C-order walk visits logical positions 0, 1, …, size-1, the k-th value and the k-th unravelled coordinate always line up. Everything documented on np.NDRefIter<T> about the ref struct enumerator, disposal under foreach, and restart-on-re-enumeration applies.

public readonly struct np.NDEnumerateRef<T> where T : unmanaged

Type Parameters

T

The array's exact element type (a ref cannot convert).

Inherited Members

Methods

GetEnumerator()

Builds a fresh C-order iterator; foreach disposes it for you.

public np.NDEnumerateRef<T>.Enumerator GetEnumerator()

Returns

np.NDEnumerateRef<T>.Enumerator