Changes in libcfa/src/enum.hfa [5eb3f65:259012e]
- File:
-
- 1 edited
-
libcfa/src/enum.hfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/enum.hfa
r5eb3f65 r259012e 3 3 #include "iostream.hfa" 4 4 5 forall( E) trait Bounded {5 forall( E ) trait Bounded { 6 6 E lowerBound(); 7 7 E upperBound(); 8 8 }; 9 9 10 forall( E | Bounded(E)) trait Serial {11 unsigned fromInstance( E e);12 E fromInt( unsigned i);13 E succ( E e);14 E pred( E e);10 forall( E | Bounded(E) ) trait Serial { 11 unsigned fromInstance( E e ); 12 E fromInt( unsigned i ); 13 E succ( E e ); 14 E pred( E e ); 15 15 }; 16 16 17 17 // Design one 18 forall(E, V | Serial(E)) trait CfaEnum { 19 char * label(E e); 20 unsigned int posn(E e); 21 V value(E e); 22 char * type_name(E e); 18 forall( E, V | Serial(E) ) trait CfaEnum { 19 char * label( E e ); 20 unsigned int posn( E e ); 21 V value( E e ); 23 22 }; 24 23 25 forall(ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V)) 26 ostype & ?|?(ostype&, E); 24 // I/O 27 25 28 forall(ostype & | basic_ostream(ostype), E| CfaEnum(E, quasi_void)) 29 ostype & ?|?(ostype&, E); 26 forall( ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V) ) { 27 ostype & ?|?( ostype &, E ); 28 OSTYPE_VOID( E ); 29 } 30 31 forall( ostype & | basic_ostream(ostype), E | CfaEnum(E, quasi_void) ) 32 ostype & ?|?( ostype &, E ); 30 33 31 34 // Design two <- should go for this if we have change the cost model … … 39 42 // }; 40 43 41 forall( ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V)) {44 forall( E, V | CfaEnum(E, V) ) { // relational operators 42 45 int ?==?(E, E); 46 int ?!=?(E, E); 47 int ?<?(E, E); 43 48 int ?<=?(E, E); 49 int ?>?(E, E); 44 50 int ?>=?(E, E); 45 int ?<?(E, E);46 int ?>?(E, E);47 48 // E ++?( E & lhs );49 // E ?++( E & lhs );50 51 }
Note:
See TracChangeset
for help on using the changeset viewer.