Both sides previous revisionPrevious revision | |
rfc:enumset [2021/03/14 08:16] – bwoebi | rfc:enumset [2021/03/14 13:37] (current) – bwoebi |
---|
* It also is parent class to all ''UnitEnum''. | * It also is parent class to all ''UnitEnum''. |
* Its constructor creates an ''EnumSet<E>'' with all passed enum values. | * Its constructor creates an ''EnumSet<E>'' with all passed enum values. |
* Doing an ''(array)'' cast on the ''EnumSet<E>'' instance returns all contained values. | * Doing an (explicit) ''(array)'' cast on the ''EnumSet<E>'' instance returns all contained values. |
* Doing an (implicit) ''(bool)'' cast on the ''EnumSet<E>'' instance returns ''true'', unless it is empty. Then it returns ''false''. | * Doing an (explicit) ''(bool)'' cast on the ''EnumSet<E>'' instance returns ''true'', unless it is empty. Then it returns ''false''. |
* The ''cases'' static method is promoted to ''EnumSet<E>''. It also returns an ''EnumSet<E>'' containing all enum values instead of an array. | * The ''cases'' static method is promoted to ''EnumSet<E>''. It also returns an ''EnumSet<E>'' containing all enum values instead of an array. |
* Two ''EnumSet'' instances are only weakly equal (''=='') if the contents are the same. The order is ignored for equivalence checking. | * Two ''EnumSet'' instances are only weakly equal (''=='') if the contents are the same. The order is ignored for equivalence checking. |
The keys of this iterator are continuous and starting at zero. | The keys of this iterator are continuous and starting at zero. |
| |
''EnumSet'' instances can be cast to array like any other object. This is equivalent to applying ''iterator_to_array()'' here. | ''EnumSet'' instances can be cast to array like any other object. This is equivalent to applying ''iterator_to_array()'' here. This is not special or different to ''(array)'' casts of other objects. |
| |
Conversely, ''EnumSet'' being so close to arrays in behavior, the weak comparison (''=='') semantics of ''EnumSet'' are also identical to those of arrays: Two ''EnumSet'' instances are weakly equal if the contents are the same, regardless of the ordering. | Conversely, ''EnumSet'' being so close to arrays in behavior, the weak comparison (''=='') semantics of ''EnumSet'' are also identical to those of arrays: Two ''EnumSet'' instances are weakly equal if the contents are the same, regardless of the ordering. |