Lazily Partially Sorted

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 15 13:01:43 PST 2015


I would like to implement a variant of Sorted at

https://github.com/D-Programming-Language/phobos/pull/2793

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?


More information about the Digitalmars-d-learn mailing list