Enhanced C#
Language of your choice: library documentation
|
Public fields | |
Node | _currentNode |
InternalList< Node > | _stack |
uint | _hc |
int | _i |
Properties | |
T | Current [get] |
object System.Collections.IEnumerator. | Current [get] |
Public Member Functions | |
Enumerator (InternalSet< T > set) | |
void | Reset (InternalSet< T > set) |
bool | MoveNext () |
void | SetCurrentValue (T value, ref InternalSet< T > set, IEqualityComparer< T > comparer) |
Changes the value associated with the current key. More... | |
bool | RemoveCurrent (ref InternalSet< T > set) |
Removes the current item from the set, and moves to the next item. More... | |
void IDisposable. | Dispose () |
void System.Collections.IEnumerator. | Reset () |
Static Public Member Functions | |
static void | SetCurrentValueCore (ref T slot, T value, IEqualityComparer< T > comparer) |
|
inline |
Removes the current item from the set, and moves to the next item.
Efficiency note: a normal Remove operation can delete a child node when there are still two items left in the child (the items can be transferred to the parent node). RemoveCurrent, however, only deletes child nodes that become completely empty, because it would be very difficult to implement MoveNext() correctly (meaning, it would be very difficult to enumerate every item exactly once) if the tree were "rebalanced" like this during enumeration.
Therefore, in rare cases, a set whose size decreases via this method will use significantly more memory than necessary. And in general, adding new items later will not re-use the mostly-empty nodes unless the new items used to be in the set (or have similar hashcodes).
|
inline |
Changes the value associated with the current key.
comparer | Optional. If comparer!=null, it is used to verify that the new value is equal to the old value. |
ArgumentException | According to the comparer provided, the new value is not "equal" to the old value. |
The new value must compare equal to the old value, since the new value is placed at the same location in the trie. If a value is placed in the wrong location, it becomes irretrievable (except via enumerator), as search methods will be looking elsewhere for it.