Struct ScyllaMap<TKey, TValue>.Enumerator
Value-type enumerator for ScyllaMap<TKey, TValue> that enables allocation-free
foreach iteration when the concrete map type is used directly (the compiler resolves
GetEnumerator() without going through an interface, avoiding heap allocation of the
enumerator box).
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public struct ScyllaMap<TKey, TValue>.Enumerator
Remarks
Only slots in Scylla.Core.Structures.ScyllaMap<TKey, TValue>.STATE_OCCUPIED state are yielded; empty and tombstone slots are skipped automatically. Modifying the map during enumeration produces undefined behaviour.
Constructors
Enumerator(ScyllaMap<TKey, TValue>)
Initializes a new instance of the enumerator for the specified map. Takes a snapshot of the current table capacity so that the iteration bound is stable even if the map's arrays are replaced by a rehash during enumeration (undefined behaviour, but at least no out-of-bounds access occurs).
Declaration
public Enumerator(ScyllaMap<TKey, TValue> map)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaMap<TKey, TValue> | map | The map to enumerate. Must not be |
Properties
Current
Gets the key/value pair at the current position of the enumerator.
The value is undefined before the first call to MoveNext() and after
MoveNext() returns false.
Declaration
public readonly KeyValuePair<TKey, TValue> Current { get; }
Property Value
| Type | Description |
|---|---|
| KeyValuePair<TKey, TValue> |
Methods
MoveNext()
Advances the enumerator to the next occupied entry, skipping all empty and deleted slots.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool |
|