here is a snippet showing what I am trying to achieve:
type
TMyObject<T> = class (TObject)
function GetVarType(Value: T): TVarType;
end;
function TMyObject<T>.GetVarType(Value: T): TVarType;
var
TmpValue: Variant;
begin
TmpValue := Variant(Value); //Invalid typecast
Result := VarType(TmpValue);
end;
I know that above apporach with typecast is naive but I hope you get the idea. I would like to replace it with some conversion mechanism.
TMyObject will be always of simple type like Integer, String, Single, Double.
The purpose of such conversion is that function VarType gives me integer constant for each simple type which I can store somewhere else.
I would like to know if such conversion is possible?
Thanks for your time.