std::copy_backward

cppreference.com

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

Back to top

cpp2reference.com licensed under CC-BY-SA and GFDL.