Differences From Artifact [c96de2738d81e418]:
- File
tricks/tricks.d
- 2010-11-13 02:48:58 - part of checkin [1c01f44f52] on branch trunk - simplepatternmatch (user: kinaba) [annotate]
To Artifact [d1500d1519df592c]:
- File
tricks/tricks.d
- 2010-11-13 05:38:21 - part of checkin [078444a806] on branch trunk - additional primitives for doing typechecking (user: kinaba) [annotate]
126 } 126 }
127 127
128 override int opCmp(Object rhs_) const /// member-by-member compare 128 override int opCmp(Object rhs_) const /// member-by-member compare
129 { 129 {
130 if( auto rhs = cast(typeof(this))rhs_ ) 130 if( auto rhs = cast(typeof(this))rhs_ )
131 { 131 {
132 foreach(i,_; this.tupleof) 132 foreach(i,_; this.tupleof)
> 133 if( this.tupleof[i] != rhs.tupleof[i] ) {
> 134 auto a = this.tupleof[i];
> 135 auto b = rhs.tupleof[i];
> 136 return cast(SC_Unqual!(typeof(a)))a < b
> 137 }
133 if(auto c = typeid(_).compare(&this.tupleof[i],& | 138 // if(auto c = typeid(_).compare(&this.tupleof[i],&
134 return c; | 139 // return c;
135 return 0; 140 return 0;
136 } 141 }
137 assert(false, sprintf!"Cannot compare %s with %s"(typeid(this), 142 assert(false, sprintf!"Cannot compare %s with %s"(typeid(this),
138 } 143 }
139 } 144 }
> 145
> 146 alias std.traits.Unqual SC_Unqual;
140 147
141 unittest 148 unittest
142 { 149 {
143 class Temp 150 class Temp
144 { 151 {
145 int x; 152 int x;
146 string y; 153 string y;