Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ming.mc.test;
- struct enumf( T = ushort ) {
- public:
- alias val this;
- public:
- T val = 1;
- public:
- this( T val ) {
- this.val = val;
- }
- this( int val ) {
- this.val = cast( T ) val;
- }
- public:
- void opAssign( int val ) {
- this.val = cast( T ) val;
- }
- enumf!T opBinary( string op : "+" )( T add ) {
- return enumf!T( val << add );
- }
- int opCmp( enumf!T other ) {
- if( other.val == val )
- return 0;
- else if( val > other.val )
- return 1;
- else
- return -1;
- }
- }
- enum F {
- halCenter = enumf!ushort(),
- halRight,
- valCenter = enumf!ushort( 2 ),
- valRight = enumf!ushort( 1 )
- }
- //>> Error: no property 'max' for type 'enumf!ushort'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement