www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Lazily Partially Sorted

I would like to implement a variant of Sorted at


that does completeSort of _store lazily instead of eagerly.

I guess this is a bit more complex to implement as all accessors 
of LazySorted, such as opIndex, opSlice, etc (to the underlying 
storage) needs to be wrapped by a logic that checks whether the 
underlying storage (_store) is dirty (this.dirtyIndex > 
this._store.length) and if so sorts it.

Is there some clever D way to implement this?
Feb 15 2015