concatenate 2 vectors in c++

#include <iostream>
#include <vector>

int main() {
    // Step 1: Declare and initialize two vectors
    std::vector<int> vector1 = {1, 2, 3};
    std::vector<int> vector2 = {4, 5, 6};

    // Step 2: Create a new vector to store the concatenated result
    std::vector<int> concatenatedVector;

    // Step 3: Reserve space in the new vector to avoid reallocations
    concatenatedVector.reserve(vector1.size() + vector2.size());

    // Step 4: Copy elements from the first vector to the concatenated vector
    concatenatedVector.insert(concatenatedVector.end(), vector1.begin(), vector1.end());

    // Step 5: Copy elements from the second vector to the concatenated vector
    concatenatedVector.insert(concatenatedVector.end(), vector2.begin(), vector2.end());

    // Step 6: Display the concatenated vector
    std::cout << "Concatenated Vector: ";
    for (const auto& element : concatenatedVector) {
        std::cout << element << " ";
    }

    return 0;
}