C++ array shift to element

arrays, c++, shift

Solution

`std::rotate` (`#include <algorithm>`).

#include <algorithm>
#include <iterator>
std::rotate(std::begin(arr), std::begin(arr) + index, std::end(arr));

Note that this will rotate the array in place.

Problem

Ok the title is not the best but here is what im looking for. ``` int arr[] = {3, 4, 5, 6, 7}; int index = 2; someFunctionICantRemember(int arr, int index); // result {5, 6, 7, 3, 4} ``` I saw this function on www.cplusplus.com but i cant find it anymore. It was "built in" as far i can remember.

Original source