I have two set type variables and I need to check if the first is a subset of the second one.
type
TMyValue = (mvOne, mvTwo, mvThree);
TMyValues = set of TMyValue;
...
var
V1 : TMyValues;
V2 : TMyValues;
begin
V1 := [mvOne, mvTwo];
V2 := [mvOne, mvTwo, mvThree];
if(V1 in V2)
then ShowMessage('V1 is a subset of V2')
else ShowMessage('V2 is not a subset of V2');
end;
The example code gives me the following error on compiling:
[DCC Error] Unit1.pas(36): E2010 Incompatible types: 'TMyValues' and 'TMyValue'
Is there an operator or an "embedded function" to check if values of V1 are all in V2?
Set operator <=
allow to check whether V1 is subset of V2 (reference to online help)
if(V1 <= V2)...
Note that empty set is subset of any set.
Operator in
should check appearance of single element in set, so it's usage was wrong here.