Hello everybody, it's my first question here, glad to have found this site.
My question deals with the new Generics feature in Delphi 2009. Basically I tried to write a generic wrapper class for an existing hash map implementation. The existing implementation stores (String, Pointer) pairs, so in the wrapper class I have to cast between the generic parameter type T and the Pointer type and vice versa.
type THashMap <T : class> = class
private
FHashList : THashList;
...
end;
I thought of a cast like this (Value : T)
Value := (TObject (Ptr)) as T
But this doesn't work. The compiler tells me 'Operator not applicable to this operand type'.
Somebody has some hints? Thanks a lot in advance.