How do I check or change which set elements are present, using RTTI? I want to be able to check, add and remove T:TElements from ST:TElementSet.
How do I check or change which set elements are present, using RTTI? I want to be able to check, add and remove T:TElements from ST:TElementSet.
type
TElements = (elA, elB, elC);
TElementSet = set of TElements;
TMyClass = class
property SetValue:ST;
end;
Generics doesn't enable me to tell the compiler that T is an enumerated type and that ST is a set of T.
RTTI enables me to identify the types as tkEnumeration and tkSet - but I am unsure if I can make a strict connection between the two using RTTI. That doesn't really matter as I only need to twiddle the set bits by ordinal value.
The question is: Can I do this safely, using Generics and RTTI, and if so - how?
Examples and/or references to prior art would be appreciated.
http://stackoverflow.com/questions/33173534/how-do-i-check-or-change-which-set-elements-are-present-using-rtti
http://stackoverflow.com/questions/33173534/how-do-i-check-or-change-which-set-elements-are-present-using-rtti
type
TElements = (elA, elB, elC);
TElementSet = set of TElements;
TMyClass
property SetValue:ST;
end;
Generics doesn't enable me to tell the compiler that T is an enumerated type and that ST is a set of T.
RTTI enables me to identify the types as tkEnumeration and tkSet - but I am unsure if I can make a strict connection between the two using RTTI. That doesn't really matter as I only need to twiddle the set bits by ordinal value.
The question is: Can I do this safely, using Generics and RTTI, and if so - how?
Examples and/or references to prior art would be appreciated.
http://stackoverflow.com/questions/33173534/how-do-i-check-or-change-which-set-elements-are-present-using-rtti
http://stackoverflow.com/questions/33173534/how-do-i-check-or-change-which-set-elements-are-present-using-rtti
Comments
Post a Comment