Differences From Artifact [00969146488cc3dc]:
- File        
tricks/tricks.d
- 2010-11-24 17:44:58 - part of checkin [b993a8ad16] on branch trunk - auto memo and re-run feature of non @value/@macro layers re-re-re-implemented. (user: kinaba) [annotate]
 
 
To Artifact [784e82178988239d]:
- File        
tricks/tricks.d
- 2010-11-26 12:22:18 - part of checkin [23fb1b4a0e] on branch trunk - jikken before non-memo macro (user: kinaba) [annotate]
 
 
   101    101   }
   102    102   
   103    103   hash_t structuralHash(T)(T x)
   104    104   {
   105    105    alias SC_Unqual!(T) UCT;
   106    106   
   107    107    static if(is(UCT == class))
   108         -  return (cast(UCT)x).toHash();
          108  +  return (x is null ? 0 : (cast(UCT)x).toHash());
   109    109    else
   110    110    static if(SC_HasGoodHash!(UCT))
   111    111     { return typeid(UCT).getHash(&x); }
   112    112    else
   113    113    static if(is(UCT T == T[]))
   114    114     { hash_t h; foreach(e; x) h+=structuralHash(e); return h; }
   115    115    else
................................................................................
   154    154    override bool opEquals(Object rhs) const /// member-by-member equality
   155    155    {
   156    156     return opCmp(rhs) == 0;
   157    157    }
   158    158   
   159    159    override int opCmp(Object rhs_) const /// member-by-member compare
   160    160    {
   161         -  if( rhs_ is null )
   162         -   return -1;
   163    161     if( auto rhs = cast(typeof(this))rhs_ )
   164    162     {
   165    163      foreach(i,_; this.tupleof)
   166    164      {
   167    165       static if(is(typeof(_) == struct))
   168    166        auto c = (cast(SC_Unqual!(typeof(_)))this.tupleof[i]).opCmp(rhs.tupleof[i]);
   169    167       else