Differences From Artifact [783554bf667412ed]:
- File
src/util.d
- 2012-07-14 11:24:30 - part of checkin [bee0596f0f] on branch trunk - Refactoring. (user: kinaba) [annotate]
To Artifact [0665970b47ba63ed]:
- File
src/util.d
- 2012-07-15 01:58:08 - part of checkin [9d983af88c] on branch trunk - Hige parsing and rendering. (user: kinaba) [annotate]
19 19 this.tupleof = params;
20 20 }
21 21 }
22 22
23 23 template DeriveCompare()
24 24 {
25 25 override:
26 - bool opEquals(Object rhs)
26 + bool opEquals(Object rhs) const
27 27 {
28 28 return tuple(this.tupleof) == tuple((cast(typeof(this))rhs).tupleof);
29 29 }
30 30
31 - int opCmp(Object rhs)
31 + int opCmp(Object rhs) const
32 32 {
33 33 return tuple(this.tupleof).opCmp(tuple((cast(typeof(this))rhs).tupleof));
34 34 }
35 35
36 - hash_t toHash()
36 + hash_t toHash() const
37 37 {
38 38 hash_t v = 0;
39 39 foreach(mem; this.tupleof) {
40 40 v *= 11;
41 41 static if(__traits(compiles, v^=mem))
42 42 v ^= mem;
43 43 else
................................................................................
46 46 return v;
47 47 }
48 48 }
49 49
50 50 template DeriveShow()
51 51 {
52 52 override:
53 - string toString()
53 + string toString() const
54 54 {
55 55 string str = text(typeof(this).stringof, "(");
56 56 foreach(i,mem; this.tupleof) {
57 57 if(i) str ~= ", ";
58 58 str = text(str, this.tupleof[i].stringof[5..$], ":", mem);
59 59 }
60 60 return str ~ ")";
61 61 }
62 62 }