I have a declaration like this: type TagType = (tag1,tag2,tag3,tag4,tag5); TagSetType = set of TagType;
I now want to store numbers for each of the 2^n possible set settings [tag1,tag2,tag3,tag4,tag5] [tag1,tag2,tag3,tag4 ] [tag1,tag2,tag3 ,tag5] .. and so on... so I declared this array: type TagSetArrayType = array[0..(1 shl (ord(High(TagSetTyp))+1))-1] of integer; My question: Is it possible to retrieve the corresponding array index directly from a set variable? For example, if I have var TagSet : TagSetType; var TagArray : TagSetArrayType; var I : Integer; I want to do something like this (which is not directly possible but maybe by some other way?): I := TagArray[TagSet]; I := TagArray[[tag1,tag5]]; or I := TagArray[ord(TagSet)]; I := TagArray[ord([tag1,tag5])]; I think that the compiler somehow needs to generate the bit mask for [tag1,tag5] internally anyway so maybe it's available by some function to the programmer? _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal