Simple types with generics in Delphi
delphi, generics, types
Solution
You can use the "record" keyword, to constrain to value types (not reference types):
TField<T: record> = class
private
FValue: T;
public
property Value: T read FValue write FValue;
end;
Problem
How can I create a generic class only containing primitive types? ``` TField<T: xxx> = class private FValue: T; public property Value: T read FValue write FValue; end; ``` I don't need interfaces, classes, etc, I only want booleans, ints, floats and so on... Or there is another way to do that? Thanks