std::copy_backward
Example
main: () = {
source:= std::vector<int>(4);
std::iota(source.begin(), source.end(), 1); // fills with 1, 2, 3, 4
destination:= std::vector<int>(6);
std::copy_backward(source.begin(), source.end(), destination.end());
std::cout << "destination contains: ";
for destination do (i) {
std::cout << i << ' ';
}
std::cout << '\n';
}
Output
destination contains: 0 0 1 2 3 4