Struct ScyllaHexGrid<TCell>.Enumerator
Value-type enumerator for ScyllaHexGrid<TCell> enabling allocation-free
foreach iteration on the concrete type.
Yields (Coord, Value) tuples in R-major order (iterates Q within each R row).
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public struct ScyllaHexGrid<TCell>.Enumerator
Remarks
The enumerator snapshots the grid's mutation version at construction time. Any write to the grid during enumeration causes the next MoveNext() call to throw InvalidOperationException.
Constructors
Enumerator(ScyllaHexGrid<TCell>)
Initializes a new enumerator for the specified grid, snapshotting its current version.
Declaration
public Enumerator(ScyllaHexGrid<TCell> grid)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaHexGrid<TCell> | grid | The grid to enumerate. |
Properties
Current
Gets the current (Coord, Value) pair. Only valid after a successful call to MoveNext().
Declaration
public readonly (HexCoord Coord, TCell Value) Current { get; }
Property Value
| Type | Description |
|---|---|
| (HexCoord Coord, TCell Value) |
Methods
MoveNext()
Advances the enumerator to the next cell in R-major order.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool | true if the enumerator advanced to the next cell; false if all cells have been yielded. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when the grid was modified (written to) since this enumerator was created. |