Hi All,
I am trying to use Delphi 2010's TObjectDictionary generic.
I would like to pass an enumerator of the Values
property of that generic class, and the compiler doesn't seem to want to let me... Example:
TAttributeStates = class(TInterfacedObject, IAttributeStates)
private
FStates: TObjectDictionary<TPatchAttribute, TAttributeState>;
public
constructor Create;
destructor Destroy; override;
function GetEnumerator: TObjectDictionary<TPatchAttribute, TAttributeState>.TValueEnumerator;
end;
implementation
function TAttributeStates.GetEnumerator: TObjectDictionary<TPatchAttribute, TAttributeState>.TValueEnumerator;
begin
result := FStates.Values.GetEnumerator;
end;
This fails to compile with the error:
[DCC Error] ChannelStates.pas(249): E2010 Incompatible types: 'TDictionary<Generics.Collections.TObjectDictionary<TKey,TValue>.TKey,Generics.Collections.TObjectDictionary<TKey,TValue>.TValue>.TValueEnumerator' and 'TDictionary<ChannelPatch.TPatchAttribute,ChannelStates.TAttributeState>.TValueEnumerator'
It seems that the compiler isn't resolving the sub-type properly...
Anyone have any ideas?
N@