Changeset 379

Show
Ignore:
Timestamp:
07/05/08 17:03:27 (5 months ago)
Author:
FeepingCreature
Message:
  • Range improvement
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tools/tools/base.d

    r376 r379  
    911911 
    912912struct Range { 
    913   static _Range!(T) opSlice(T, U)(T from, U to) { return _Range!(T)(from, to); } 
     913  enum Start { Incl, Excl } 
     914  enum End { Incl, Excl } 
     915  static _Range!(T) opSlice(T, U)(T from, U to, Start sm=Start.Incl, End em=End.Excl) { 
     916    if (sm != Start.Incl) from++; 
     917    if (em != End.Excl) to++; 
     918    return _Range!(T)(from, to); 
     919  } 
    914920  static _Range!(T) opIndex(T)(T to) { return _Range!(T)(Init!(T), to); } 
    915921  static void opIndexAssign(T, U)(lazy U whut, T to) { (opIndex(to))=whut; }