Is there any way to determine the size in bytes of something like
TItem <T> = record
Data : T;
end;
Can I write something like
function TItem <T>.GetByteSize : Integer;
begin
if (T = String) then
Result := GetStringByteSize (Data as String)
else
Result := SizeOf (Data);
end;
or perhaps with the help of specialization?
function TItem <String>.GetByteSize : Integer;
begin
Result := GetStringByteSize (Data)
end;
function TItem <T>.GetByteSize : Integer;
begin
Result := SizeOf (Data);
end;
Thanks!