I'd like to use this new feature from C++20 of shifting a vector to the right std::shift_right.
Something that I'm not sure about is how can I get the last element to the beginning of the vector after shifting?
Like in the example above... Where I'm saving the last element in a temp variable and then after shifting I set the first element to be the temp variable.
#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
std::vector<int> seq = { 5, 4, 3, 2, 1 };
std::vector<int>::iterator it;
std::vector<int>::iterator temp;
temp = seq.end() - 1;
std::shift_right(seq.begin(), seq.end(), 1);
std::replace(seq.begin(), seq.end(), seq.at(0), *temp);
for (it = seq.begin(); it != seq.end(); it = std::next(it))
std::cout << *it << " ";
return 0;
}