In Delphi I can initialize a constant array of non generic record like this:
type
TMapEntry = record
Key: Integer;
Value: Integer;
end;
const
Arr: array[0..0] of TMapEntry = ((Key: 1; Value: 10));
But when I try to extent the code in a more generic way then I can't initialize the constant array:
type
TMapEntry<KeyType, ValueType> = record
Key: KeyType;
Value: ValueType;
end;
const
Arr: array[0..0] of TMapEntry<Integer, Integer> = ((Key: 1; Value: 10)); //<-- Compile error
I even tried to use a type alias but got the same compile error:
type
TIntMapEntry = TMapEntry<Integer, Integer>;
const
Arr: array[0..0] of TIntMapEntry = ((Key: 1; Value: 10)); //<-- Compile error
Is there any way to initialize a constant array of generic record?
PS: I am using Delphi 10.3