[swift-evolution] Proposal: Implement a rotate algorithm, equivalent to std::rotate() in C++
Sergey Bolshedvorsky
sergey at bolshedvorsky.com
Sun Dec 13 04:20:38 CST 2015
Hi everyone,
I’ve selected a ticket SR-125 as my first task (https://bugs.swift.org/browse/SR-125).
I would like to propose an implementation of this method in Swift stdlib.
std::rotate() method performs a left rotation on a range of elements.
C++ declaration is void rotate (ForwardIterator first, ForwardIterator middle, ForwardIterator last)
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.
A precondition of this function is that [first, n_first) and [middle, last) are valid ranges.
What are your thoughts?
Sergey
More information about the swift-evolution
mailing list