<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><blockquote type="cite" class="">On Dec 13, 2015, at 2:20 AM, Sergey Bolshedvorsky via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">Hi everyone,<br class=""><br class="">I’ve selected a ticket SR-125 as my first task (<a href="https://bugs.swift.org/browse/SR-125" class="">https://bugs.swift.org/browse/SR-125</a>).<br class=""><br class="">I would like to propose an implementation of this method in Swift stdlib.<br class=""><br class="">std::rotate() method performs a left rotation on a range of elements.<br class="">C++ declaration is void rotate (ForwardIterator first, ForwardIterator middle, ForwardIterator last)<br class="">Specifically, it swaps the elements in the range [first, last) in such a way that the element middle becomes the first element of the new range and middle - 1 becomes the last element.<br class="">A precondition of this function is that [first, n_first) and [middle, last) are valid ranges.<br class=""><br class="">What are your thoughts?<br class=""></blockquote><div class=""><br class=""></div><div class="">This is a really important algorithm, with applications even in GUI programming (see <a href="http://www.bfilipek.com/2014/12/top-5-beautiful-c-std-algorithms.html#slide" class="">slide</a> and <a href="http://www.bfilipek.com/2014/12/top-5-beautiful-c-std-algorithms.html#gather" class="">gather</a>), so I'm really happy someone is taking it on. You'll need different implementations <a href="http://stackoverflow.com/questions/21160875/why-is-stdrotate-so-fast" class="">depending on the index's protocol conformance</a>. C++ implementations can get <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?view=markup&pathrev=251836" class="">pretty sophisticated</a>. Would you like additional thoughts (and if so, of what nature), or will those do? ;-)</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">-Dave<br class=""><br class=""><br class=""></div><br class=""></div></body></html>