<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks Daniel - comments regarding Array vs CollectionType are duly noted. Stable sort is next on my list unless someone else tackles it before I finish this work. I suppose I’ll be adding <i class="">isPartitioned</i> as well at some point.<div class=""><br class=""></div><div class="">Thanks again for the comments</div><div class="">Jeff<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 15, 2016, at 5:45 PM, Daniel Vollmer via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On 15 Feb 2016, at 21:35, Jeff Hajewski via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">Hello,<br class=""><br class="">Description<br class="">Implement analogs to C++’s binary_search, lower_bound, upper_bound, and equal_range algorithms.<br class=""><br class="">Initial Proposal<br class="">I propose adding four methods for generic Array and adding four methods for Arrays that conform to Comparable:<br class=""></blockquote><br class="">Over the weekend, I looked at what I would require for porting a simple kd-tree from C++ to Swift, and other than stable sort I was also lacking equal_range. But I think that defining the interface for these methods on Array would be a mistake: One thing the STL got very right is that the caller gets to pick the iterators (ranges) for the algorithm. For the kd-tree, I would want to stable_sort and apply equal_range to recursively smaller segments (slices?) of an Array, and not always the complete one.<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Daniel.<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>