Changeset 0c327ce for libcfa/src/enum.hfa
- Timestamp:
- Jul 12, 2024, 3:30:06 PM (6 days ago)
- Branches:
- master
- Children:
- 76b507d
- Parents:
- 9c447e2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/enum.hfa
r9c447e2 r0c327ce 1 1 #pragma once 2 2 3 #include <assert.h> 3 4 #include "iostream.hfa" 4 5 … … 10 11 forall( E | Bounded( E ) ) trait Serial { 11 12 unsigned fromInstance( E e ); 13 E fromInt_unsafe( unsigned i ); 14 E succ_unsafe( E e ); 15 E pred_unsafe( E e ); 16 }; 17 18 forall( E | Serial( E ) ) { 12 19 E fromInt( unsigned i ); 13 20 E succ( E e ); 14 21 E pred( E e ); 15 }; 22 int Countof( E e ); 23 } 24 25 // forall( E | Bounded(E) ) trait SafeSerial { 26 // // unsigned fromInstance( E e ); 27 // E fromInt_unsafe( unsigned i ); 28 // // E succ_unsafe( E e ); 29 // //E pred_unsafe( E e ); 30 31 // unsigned fromInstance( E e ); 32 // E fromInt( unsigned i ); 33 // E succ( E e ); 34 // E pred( E e ); 35 // }; 16 36 17 37 forall( E | Serial( E ) ) trait CfaEnum { … … 33 53 OSTYPE_VOID( E ); 34 54 } 35 36 // forall( ostype & | ostream( ostype ), E | CfaEnum( E, quasi_void ) ) {37 // ostype & ?|?( ostype &, E );38 // OSTYPE_VOID( E );39 // }40 41 // Design two <- should go for this if we have change the cost model42 // forall( E | Serial( E ) ) trait CfaEnum {43 // char * label( E e );44 // unsigned int posn( E e );45 // };46 47 // forall( E, V| CfaEnum( E)) trait TypedEnum {48 // V value( E e);49 // };50 55 51 56 static inline
Note: See TracChangeset
for help on using the changeset viewer.