Hi All,
say, I have a class TTreeT; in the destructor of that class, is it
possible to know the actual type of T? I want to do things like:
generic TTreeT = class
public
Data: T;
destructor Destroy; override;
end;
destructor TTree.Destroy;
begin
... ...
if Data is TObject then
Am 24.09.2013 11:19, schrieb Xiangrong Fang:
Hi All,
say, I have a class TTreeT; in the destructor of that class, is it
possible to know the actual type of T? I want to do things like:
generic TTreeT = class
public
Data: T;
destructor Destroy; override;
end;
destructor TTree.Destroy;
Am 24.09.2013 11:25, schrieb Sven Barth:
Am 24.09.2013 11:19, schrieb Xiangrong Fang:
Hi All,
say, I have a class TTreeT; in the destructor of that class, is it
possible to know the actual type of T? I want to do things like:
generic TTreeT = class
public
Data: T;
destructor Destroy;
But it's not a good idea as you'd still need to convert Data to a TObject
(e.g. by using a cast), but that will fail if Data is something else than a
pointer-like type...
This worked in my TTree class (destructor):
if PTypeInfo(TypeInfo(Data))^.Kind = tkObject then TObject(Data).Free;
I
Am 24.09.2013 11:53, schrieb Xiangrong Fang:
But it's not a good idea as you'd still need to convert Data to a
TObject (e.g. by using a cast), but that will fail if Data is
something else than a pointer-like type...
This worked in my TTree class (destructor):
if