c++ vector pop first element

To remove the first element from a C++ vector, you can use the erase method with the begin() iterator as the argument. This will remove the first element from the vector.

Here's an example:

#include <iostream>
#include <vector>

int main() {
    std::vector<int> vec = {1, 2, 3, 4, 5};

    vec.erase(vec.begin());

    for (int i : vec) {
        std::cout << i << " ";
    }

    return 0;
}

In this example, the erase method with vec.begin() as the argument is used to remove the first element from the vector vec. The output of the program will be 2 3 4 5, as the first element 1 has been removed from the vector.