Sorted ranges in combined sorted order?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 5 11:33:57 PST 2017


On 12/31/2016 02:28 PM, Matthew Gamble wrote:

 > Please let me know if you have any suggestions.

I've seen this just now. Random and trivial observations:

- Assigning to _minPosResult could be in a separate function like 
prepareMinPosResult() called from multiple places

- There could be a unittest for an empty array (and an empty range element)

- It's personal taste and not obvious from its documentation but 
minPos() and most (all?) other Phobos algorithms can take proper lambdas 
as well:

     _source.minPos!((a, b) => a.front() < b.front())()

 > P.S. Ali, I a big fan of your book on D; it was the first book I read on
 > D and gave me a great start. :)

Very happy to hear that! :)

Ali



More information about the Digitalmars-d-learn mailing list