Class InterningCache<T>
A cache that interns values: it maps each input value to a value that is structurally equal to the input and all structurally equal input values are mapped to the same output value as long as that output value is live.
Inheritance
System.Object
InterningCache<T>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Flame.Collections
Assembly: Flame.dll
Syntax
public sealed class InterningCache<T>
where T : class
Type Parameters
Name | Description |
---|---|
T |
Constructors
| Improve this Doc View SourceInterningCache(IEqualityComparer<T>)
Creates an interning cache from a comparer.
Declaration
public InterningCache(IEqualityComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEqualityComparer<T> | comparer | A comparer that tests if input values are structurally equal. |
InterningCache(IEqualityComparer<T>, Func<T, T>)
Creates an interning cache from a comparer and an initialization function.
Declaration
public InterningCache(IEqualityComparer<T> comparer, Func<T, T> initialize)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEqualityComparer<T> | comparer | A comparer that tests if input values are structurally equal. |
System.Func<T, T> | initialize | A function that initializes output values. |
Methods
| Improve this Doc View SourceIntern(T)
Interns a particular value.
Declaration
public T Intern(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | An input value. |
Returns
Type | Description |
---|---|
T | A value that is structurally equal to the input value. |