Changeset 07e9df1
- Timestamp:
- May 12, 2024, 8:38:32 PM (6 months ago)
- Branches:
- master
- Children:
- ec20ab9
- Parents:
- 083e637
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/enum.hfa
r083e637 r07e9df1 1 1 #pragma once 2 2 3 forall( E) trait Bounded {4 5 3 forall( E ) trait Bounded { 4 E lowerBound(); 5 E upperBound(); 6 6 }; 7 7 8 forall( E | Bounded(E)) trait Serial {9 unsigned fromInstance(E e);10 E fromInt(unsigned i);11 E succ(E e);12 E pred(E e);8 forall( E | Bounded( E ) ) trait Serial { 9 unsigned fromInstance( E e ); 10 E fromInt( unsigned int posn ); 11 E succ( E e ); 12 E pred( E e ); 13 13 }; 14 14 15 forall( E, T) trait TypedEnum {16 T valueE(E e);17 char * labelE(E e);18 unsigned int posE(E e);15 forall( E, T ) trait TypedEnum { 16 T valueE( E e ); 17 char * labelE( E e ); 18 unsigned int posE( E e ); 19 19 }; 20 20 21 forall( E, T| TypedEnum(E, T)) {22 23 int ?==?(E l, E r); 24 int ?!=?(E l, E r); 25 int ?!=?(E l, zero_t); 26 int ?<?(E l, E r); 27 int ?<=?(E l, E r); 28 int ?>?(E l, E r); 29 int ?>=?(E l, E r); 21 forall( E, T | TypedEnum( E, T ) ) { 22 // comparison 23 int ?==?( E l, E r ); // true if l and r are same enumerators 24 int ?!=?( E l, E r ); // true if l and r are different enumerators 25 int ?!=?( E l, zero_t ); // true if l is not the first enumerator 26 int ?<?( E l, E r ); // true if l is an enuemerator before r 27 int ?<=?( E l, E r ); // true if l before or the same as r 28 int ?>?( E l, E r ); // true if l is an enuemrator after r 29 int ?>=?( E l, E r ); // true if l after or the same as r 30 30 }
Note: See TracChangeset
for help on using the changeset viewer.