    #include <vector>
    #include <iostream>

    int main()
    {
        std::vector<int> v { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
        auto it = v.begin() + 5;
        // replace the current element with the back of the vector,
        // then shrink the size of the vector by 1.
        *it = std::move(v.back());
        v.pop_back();

        for (auto n : v) {
            std::cout << n << " ";
        }
        std::cout << "\n";
    }
